Hey there! In some other plugins I have looked upon, in the config file sometimes they have an option to let you use colour codes (&1, &2, &a, &b, etc.). Now looking upon that, how would I go about using those colour codes in just say a MOTD when the player joins? Would I first get the codes from the config file and then assign those to a ChatColour, or what would I do? Thanks!
I think something like Code: String message = getConfig().getString("Message")(); message = message.replace("&6", ChatColor.GOLD());
String message = <your config message here> message = message.replaceAll("&1", ChatColor.GREEN + ""); Of course it doesn't have to be 1 with green, you can make ti whatever you want.
So essentially I could make it so that if the person puts in '&GREEN', it does ChatColor.GREEN? Okay, cool then. Thanks guys for the info.
The most convenient way for you is to use the built-in ChatColor method translateAlternateColorCodes: Code: String coloredMessage = ChatColor.translateAlternateColorCodes('&', message); That will replace color codes denoted with the given char (& in this case) with the appropiate ChatColor (they are represented with a ยง, by the way). You can't do something like "&GREEN" with that method, but it's really easy for you to do and it follows the standards.
Or you can throw this function in your code somewhere: static String colorize(String string) { return string.replaceAll("(?i)&([a-k0-9])", "\u00A7$1"); } Then just put colorize() around any string where you want to include color codes (&0 - &f)