Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adventure Component support #240

Open
3 tasks done
Braekpo1nt opened this issue Aug 21, 2024 · 3 comments
Open
3 tasks done

Adventure Component support #240

Braekpo1nt opened this issue Aug 21, 2024 · 3 comments

Comments

@Braekpo1nt
Copy link

Just making sure

  • I have read the wiki and made sure, this feature is not yet in the plugin.
  • I believe, that this feature is possible to implement.
  • 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.

@Andre601
Copy link
Contributor

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.

@Braekpo1nt
Copy link
Author

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.

@Andre601
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants