Convert chat colors function. - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: Convert chat colors function. (/thread-1581.html) |
Convert chat colors function. - tryy3 - 09-15-2014 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? RE: Convert chat colors function. - xoft - 09-15-2014 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 @mentions; just didn't get around to it). RE: Convert chat colors function. - tryy3 - 09-15-2014 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? RE: Convert chat colors function. - xoft - 09-15-2014 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). RE: Convert chat colors function. - tryy3 - 09-15-2014 hmm... So I just replace all the &(chat code) with §(chat code) no need to use cChatColor? RE: Convert chat colors function. - xoft - 09-15-2014 Not really, the cChatColor is only a container for the constants, not much else. RE: Convert chat colors function. - tryy3 - 09-15-2014 Ah, alright, thanks Oh and I was testing around with chat colors, and I noticed you cant type any formattings like @lBold @nUnderline etc. Is there a reason to this? And thanks for the help btw |