Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Updated API #183

Merged
merged 3 commits into from
Feb 7, 2024
Merged

Updated API #183

merged 3 commits into from
Feb 7, 2024

Conversation

TrueWinter
Copy link
Contributor

I finally have time to work on plugins again, so thought I'd work on the API that I kinda left in a half-finished state.

Example for Bukkit:

HuskChat huskChat = (HuskChat) getServer().getPluginManager().getPlugin("HuskChat");
BukkitPlayer player = BukkitPlayer.adapt(getServer().getPlayer("TrueWinter"));
huskChat.getAPI().sendChatMessage("global", player, "Message sent through the API");

I've only tested this on Velocity and Bukkit, but it should work on Bungee too.

@WiIIiam278
Copy link
Owner

hey, welcome back! :) this looks great so far.

only thing I'd say is that I tend to prefer a singleton pattern for static API access. Have a look at HuskClaims for what I sort of mean by this: https://github.com/WiIIiam278/HuskClaims (implementing a common platform agnostic API as well as an extension of that for Bukkit)

I imagine it'd probably also be handy to have the common API not use an abstract class and allow static instantiation to allow multiplat projects to also target it :)

@TrueWinter
Copy link
Contributor Author

Done.

@WiIIiam278 WiIIiam278 merged commit 444851e into WiIIiam278:master Feb 7, 2024
1 check failed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants