-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Color problem in console for Bukkit.broadcast() #7590
Comments
You should not mix adventure components and legacy formatting (§). Either deserialize your legacy messages using the LegacyComponentSerializer (or use minimessage instead of legacy), or use the legacy method, Bukkit#broadcastMessage. This will cause the proper behaviour, as shown below: Bukkit.broadcast(Component.text("§cE")); // WRONG
Bukkit.broadcast(Component.text("E", NamedTextColor.RED));
Bukkit.broadcastMessage("§cE"); results in (e's without § are colored)
|
And how can I use NamedTextColor with the '&' ? It's in a config file for me :/ |
you use the legacy component serialiser to deserialise a legacy string into a component if you wanna have components, or there is minimessage for a modern "rich" representation of components |
If you want to use legacy ampersands, the easiest solution would be to use the LegacyComponentSerializer like this: Bukkit.broadcast(LegacyComponentSerializer.legacyAmpersand().deserialize("&cMy message here")); or, you could use minimessage instead: Bukkit.broadcast(MiniMessage.miniMessage().deserialize("<red>My message here")); 🥷 ninja'd by cat |
It works. Thanks! |
Expected behavior
It should set in colors my broadcasts. There, it don't want to set the colors in console
Observed/Actual behavior
Steps/models to reproduce
Make a broadcast in your code, like this:
Bukkit.broadcast(Component.text(PvPBoxPlugin.getInstance().getConfig().getString("reset_map_announce").replace("&", "§").replace("{time}", Integer.toString(time))));
Plugin and Datapack List
PvPBox is a custom plugin
Paper version
[16:30:54 INFO]: This server is running Paper version git-Paper-247 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) (Git: 1358d1e)
You are running the latest version
Previous version: git-Paper-232 (MC: 1.18.2)
Other
It does that bug from I updated to build 247, it don't affect the 232.
No response
The text was updated successfully, but these errors were encountered: