Player list name with wrong colors when using Kyori's components
Elikill58 opened this issue · 3 comments
Expected behavior
See this in player list name :
Observed/Actual behavior
When using §x
color code (full string: §x§f§f§0§0§0§0§x§f§f§0§0§0§0§lFONDATEUR§r §8▏ §x§f§f§0§0§0§0Elikill58
) :
When using &#
(full string: &#ff0000&#ff0000§lFONDATEUR§r §8▏ &#ff0000Elikill58
) :
Steps/models to reproduce
Use this string : &#ff0000&#ff0000§lFONDATEUR§r §8▏ &#ff0000Elikill58
or §x§f§f§0§0§0§0§x§f§f§0§0§0§0§lFONDATEUR§r §8▏ §x§f§f§0§0§0§0Elikill58
.
By using player.setPlayerListName(name)
it's working, but with player.playerListName(name)
I get the result showed before. I tried player.playerListName(Component.text(name))
or player.player.playerListName(PlainTextComponentSerializer.plainText().deserialize(name))
but both show same result.
Plugin and Datapack List
My own, and no datapack
Paper version
This server is running Paper version 1.20.6-124-master@0fcf3e3 (2024-05-29T22:05:27Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
You are running the latest version
Previous version: git-Paper-393 (MC: 1.20.4)
Other
I didn't check on older version than 1.20.6
the playerListName(Component)
methods don't take a string. It's not supported behavior to put legacy color codes inside of a component. If you want to use legacy, not good, super old, lossy string format like the legacy color codes, you have to use the LegacyComponentSerializer
and deserialize the string from there into a component.
But you should be either using components directly (Component.text("Some text", TextColor.of(0xf023d2)
or minimessage which is a lossless string format.
by stuffing that stuff into a component, you're just relying on the vanilla text renderer, which does not support any of the community-derived hacks for RGB compatibility in legacy strings, and so it's just using the last text color you apply, as that's all it understands
the
playerListName(Component)
methods don't take a string. It's not supported behavior to put legacy color codes inside of a component. If you want to use legacy, not good, super old, lossy string format like the legacy color codes, you have to use theLegacyComponentSerializer
and deserialize the string from there into a component.
Oh yes, I tested with wrong Serializer. I tested with Legacy one, and it's fixed thanks :)