[SPIGOT-7511] CraftChatMessage#fromComponent misrepresenting components Created: 31/Oct/23 Updated: 25/Dec/24 |
|
Status: | Open |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Bjarne Koll | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 0 |
Labels: | 1.20.2, chat, component, legacy, spigot |
Attachments: |
![]() |
Version: | 1.20.2 |
Guidelines Read: | Yes |
Description |
While this is already possible through simple ingame commands, spigot also has a PR lined up to finally bring more component support to places in the API. While the legacy text format is still in heavy usage across the spigot API, it cannot fully represent components, which is fine for most usecase where only text and colouring/styling is applied. One such issue arises terrible quickly when creating components that make use of inherited styling in a nested component tree, such as the following: { "text":"top", "color":"red", "extra":[ { "text":" mid ", "color":"blue" }, { "text":" inherit" } ] } which leads to the following item display in-game:
Passing this component into CraftChatMessage#fromComponent however yields a completely unusable legacy string of §ctop§9 mid§r inherit leaving inherit completely uncoloured. This is mostly related to the fact that CraftChatMessage#fromComponent does not respect the tree like layout of components but rather simply uses their flattened representation. This issue asks for improved handling of these cases, e.g. the above example should be resolved to §ctop§9 mid§c inherit which allows the legacy format to represent the component as best as possible in the context of its limited nature. |
Comments |
Comment by Bjarne Koll [ 31/Oct/23 ] |
BaseComponent#toLegacyText properly emits the missing character yea. |
Comment by md_5 [ 31/Oct/23 ] |
Is the bungee converter better? |