Last active
December 28, 2021 03:33
-
-
Save Aquazus/4a59206112dfca2f0a6a to your computer and use it in GitHub Desktop.
translateAlternateColorCodes without Bukkit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] = '\u00A7'; | |
b[i+1] = Character.toLowerCase(b[i+1]); | |
} | |
} | |
return new String(b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment