DecentHolograms icon indicating copy to clipboard operation
DecentHolograms copied to clipboard

Adventure Component support

Open Braekpo1nt opened this issue 1 year ago • 3 comments

Just making sure

  • [X] I have read the wiki and made sure, this feature is not yet in the plugin.
  • [X] I believe, that this feature is possible to implement.
  • [X] I made sure, that this feature has not been requested yet.

Problem

I am unable to achieve using Adventure API Components () in my hologram lines I think it would be useful for compatibility with other plugins.

Most importantly, the Paper API deprecated org.bukkit.ChatColor in favor of Adventure API (source).

Feature

I would like to see an overload method for DHAPI.addHologramLine() and DHAPI.setHologramLines() with net.kyori.adventure.text.Components as the content parameter. Right now, they all make use of String. It would be nice if you could also optionally use Component objects.

Alternatives

It would also be possible by providing a set of instructions for how to translate Adventure Components on the wiki to be usable as the lines in holograms.

Braekpo1nt avatar Aug 21 '24 17:08 Braekpo1nt

Just use the Legacy serializer of adventure to convert a component to a String with color codes.

The main issue I see here is the fact that DH is not only for Paper but also for Spigot, while adventure is only used and supported by Paper and its forks.

Andre601 avatar Aug 21 '24 17:08 Andre601

If the best solution is to simply use the legacy serializer, then perhaps the "Alternatives" section I listed in my issue could be implemented? i.e. a documentation page that informs people who use paper how to convert their text components to be usable by DHAPI?

I would argue, however, that Adventure is included by default in many popular Minecraft APIs, and so we would still benefit from native support in DecentHolograms.

Braekpo1nt avatar Aug 21 '24 18:08 Braekpo1nt

The main issue with supporting adventure API natively in DecentHolograms is bloating the jar.

As said is DecentHolograms not just designed for Paper servers alone, but also Spigot servers, which do not offer native Adventure Component support. Instead to have it work with DecentHolograms would we need to do a few things:

  1. Shade in the Adventure Library.
  2. Shade in the Bungee Component serializer to convert the adventure components into BungeeCord Chat API Components to then use... If Spigot also supports those for entity names that is.

This would increase the jar file's size for just having a component system work in a specific server. And that doesn't include finding out wether the server used is Paper or not, so that we don't have to init the necessary compat library.

Obviously, there is the argument of just using the library loader feature of Spigot to not shade in Adventure... But this one is awful in many ways, one of them being breaking MavenCentral's rule that prohibits the access to their main repo through automated means. And even if that wasn't an issue would the loading happen on both Spigot and Paper...

We could now make a paper-plugin.yml to not have DH load as Spigot plugin, allowing us to not load the stuff on a Paper server, but this feature is fairly new (1.19.4+) and wouldn't work on previous versions.

There would be the alternative of using a library such as Libby to do more dynamic library loading when needed... But this also has its flaws and problems to deal with.

So yeah.... There is a lot to consider here with DH, especially if d0by wants to still support Spigot here, because 99% of these issues would be solved by simply only supporting Paper... But it's not my plugin, so I can't decide this.

Andre601 avatar Aug 21 '24 23:08 Andre601