KyoriPowered / adventure

A user-interface library, formerly known as text, for Minecraft: Java Edition
https://docs.advntr.dev/
MIT License
706 stars 107 forks source link

1.19.4 content(String) method ignored? #901

Closed kangarko closed 1 year ago

kangarko commented 1 year ago

In calling TextComponent#content(String) it appears to ignore the new content.

Context: I am using ProtocolLib and listening to ClientboundSystemChatPacket which has two fields, content and adventure$content. My goal is to edit these fields before the packet gets sent.

Before adventure, this was simple. Now I am trying to get the adventure$content field which works, but after setting its new content it appears not to work anymore.

The relevant code excerpt is here. Please note that the system.out prints out "ClientboundSystemChatPacket -> set to: " as if the new content is still empty even after it has been set.

Screenshot 2023-04-12 at 18 53 19

Using Paper build 510.

Machine-Maker commented 1 year ago

Components are immutable. Calling adventureContent.content(message) doesn't mutate adventureContent, it just returns a new component with that content.

kangarko commented 1 year ago

So how can I modify the content of the ClientboundSystemChatPacket?