Component colors doesn't work

  • After careful consideration and due to limited usage, we’ve made the decision to discontinue the PaperMC forums. Moving forward, we recommend using Hangar for plugin uploads, and for all other community discussions and support, please join us on Discord.

MassonNn

New member
Apr 23, 2024
1
0
1
I have this code:
Java:
public Component prepareName(Player p, String hex) {
        String hint = this.config.getString("name-hint");
        return miniMessage.deserialize(p.getName())
                .hoverEvent(HoverEvent.showText(miniMessage.deserialize(hint)))
                .color(TextColor.fromHexString(hex))
                .clickEvent(ClickEvent.runCommand("/playerinfo " + p.getName())
        );
    }
Where hex is a string from config (staff.1.color):
YAML:
staff:
 1:
  prefix: ''
  color: '#8a8690'
But the nickname has default color in the chat:
Java:
Component message = plugin.miniMessage.deserialize(
                Objects.requireNonNull(plugin.config.getString("chat.local.text")),
                Placeholder.component("rank",
                        Component.text(rankPrefix).color(TextColor.fromHexString(color))
                        .hoverEvent(HoverEvent.showText(plugin.miniMessage.deserialize(rankHint)))
                ),
                Placeholder.component("playername", plugin.prepareName(pl, color)),
                Placeholder.component("message", e.originalMessage())
        );
Снимок экрана 2024-04-23 в 18.49.46.png
 
Last edited: