Question Adventure Component

Peng1104

New member
Jul 5, 2023
2
0
1
Adventure Component

Can any one explain for me why does paper even use this components?

I need help to transform this components into spigot components, as they are for some reason present in the new chat packets 1.19+, breaking the manipulation of this packets so that you can have multiple versions support. As for example the SystemChatPacket that is consistent between Mojang and Spigot and in every version since its introduction is broken in Paper. It has the internal serialized chat component as JSON String but in paper some times a "Adventure Component" making it really hard to be manipulated as you never know if the Packet is Mojang style or Paper style.
 

electronicboy

Administrator
Staff member
Dec 11, 2021
236
12
42
28
Paper uses adventures components as we needed a more maintained library for handling stuff, and given people where already using it, it made sense;

with spigot, you need to check 2 different fields for components, with paper, you need to check 3 in some of the packets, that's due to the stuff using field lookups rather than actual packet contents, and is on par with the same oddity that spigot made in terms of just adding an extra field; in retrospect, we can probably revert some aspects of that as we have the means to wrap adventure components as quasi mojang ones, but, not really a concern; dealing with internals is not something that is ever supported and is 100% on you to deal with the caveats of, etc

if you really need to transform components into their bungee ones, you can use the bungee serialiser, but, generally little reason to do so
 

Peng1104

New member
Jul 5, 2023
2
0
1
About the "dealing with internals is not something that is ever supported and is 100% on you to deal with the caveats of" I totally agree but I am asking help to transform this Paper chat component version into a Spigot / Mojang version I know how to made a IChatBaseComponent into a TextComponent or a TextComponent into a IChatBaseComponent, but I don't know how to make a "Adventure Component" into a TextComponent or a IChatBaseComponent or the opposite, without making a Paper Only Plugin
 

electronicboy

Administrator
Staff member
Dec 11, 2021
236
12
42
28
for paper, PaperAdventure class has methods on it, otherwise, use the gson serialiser and parse that; if you wish to mess with internals and retain compat across platforms, you just need to ensure that you only touch paper specific stuff when on Paper