WiIIiam278 / HuskChat

A simple & customizable no-frills Minecraft chat system
https://william278.net/project/huskchat
Apache License 2.0
78 stars 35 forks source link

Updated API #183

Closed TrueWinter closed 7 months ago

TrueWinter commented 7 months ago

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 commented 7 months ago

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 commented 7 months ago

Done.