diff --git a/src/main/java/net/md_5/bungee/ChatColor.java b/src/main/java/net/md_5/bungee/ChatColor.java index c5cfddbd..c42fc866 100644 --- a/src/main/java/net/md_5/bungee/ChatColor.java +++ b/src/main/java/net/md_5/bungee/ChatColor.java @@ -139,4 +139,17 @@ public enum ChatColor return STRIP_COLOR_PATTERN.matcher(input).replaceAll(""); } + public static String translateAlternateColorCodes(char altColorChar, String textToTranslate) + { + char[] b = textToTranslate.toCharArray(); + for (int i = 0; i < b.length - 1; i++) + { + if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i+1]) > -1) + { + b[i] = ChatColor.COLOR_CHAR; + b[i+1] = Character.toLowerCase(b[i+1]); + } + } + return new String(b); + } }