Cuberite Forum

Full Version: Convert chat colors function.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there any function to convert chat colors?
When I say chat colors I mean, when someone types
"Hi &aI &bLove &cColors"
I can just run a command and it will auto convert the &(Color Code) to a color?
I know bukkit has translateAlternateColorCodes() but I am wondering if MCServer might have any similiar function or will I need to make my own function?
You don't need any translation, for chat messages it works automatically, only use @ instead of & (we need to change this, because it mangles email addresses and ; just didn't get around to it).
I have a motd file and it contains &(color code) colors in it, so I need to convert that string to chat colors.
Right now I am trying to convert the colors in the server desc (the desc of a server, in the server list) so I assume its just to convert them to chat colors?
Unlike chat messages, the server description doesn't auto-convert colors, you need to specify them explicitly using the § character (and be careful about utf-8 encoding).
hmm... So I just replace all the &(chat code) with §(chat code) no need to use cChatColor?
Not really, the cChatColor is only a container for the constants, not much else.
Ah, alright, thanks Smile
Oh and I was testing around with chat colors, and I noticed you cant type any formattings like


etc.

Is there a reason to this?
And thanks for the help btw Smile