Closed anna-is-cute closed 8 years ago
Unless Bukkit has expanded the message broadcast API in the last few months, this wouldn't be possible without dropping some features. Most notably, the FancyMessage.send(...)
method relies on CraftBukkit APIs to send raw JSON messages to players, since Bukkit doesn't provide any API to do the same.
(At one point I did consider sending a PR to Bukkit adding the API I'd need, but I was told at the time by people more familiar with the process than I that they'd be unlikely to accept such a change. They seem to see the JSON message format as an "implementation detail" of the Minecraft protocol as it exists today, and thus not suitable for exposure via the public interface.)
Is there a particular third-party Bukkit API implementation you're looking to target? I could always look at baking in support for another backend if it's popular enough.
I was looking at Glowstone. You could check out which server class you're using and use Reflection (using a system similar to mbaxter's NMS abstraction) to dynamically check the server type and use relevant features.
This might be higher-priority than I'd originally determined. The unfolding legal drama around Bukkit is making a lot of people jump ship and I'd kind of like to start targeting the new majority platform for server mod developers – whatever that ends up being – once some of the dust settles and a clear community consensus appears.
It is also worth noting that Spigot 1.8 does not have Gson shaded in, apparently, which breaks Fanciful.
However, they have an API for fancy messages. Not sure if you think it's in the scope of this plugin, but it would be great if you utilized that for people using Spigot. That way, developers can stick to just using Fanciful and not have to complicate their code.
As far as GSON shaded in, #50 does this. Also, as @mkremins mentioned, CraftBukkit is no longer being actively developed (ATM). This means we definitely need to work on supporting other implementations. If we need to access implementation details, we could build a system where we use different reflections depending on the version string, and then if we don't have a special reflection for a specific version, we default to CB/NMS-based reflection.
This should be fixed as of commit 11a7e606650bf59351b3ebfce2da3af13b7e898b. Since we're now using the standard /tellraw
command to send messages, we're no longer dependent on any CraftBukkit implementation details.
Fanciful is currently dependent on CB being used (or its derivatives). It would be immensely useful if this was not the case. I'm not sure if this is at all possible, but removing the need for OBC and NMS imports would be awesome, since plugins using Fanciful could then run on other Bukkit implementations.