Skip to content

Instantly share code, notes, and snippets.

@Aquazus
Last active December 28, 2021 03:33
Show Gist options
  • Save Aquazus/4a59206112dfca2f0a6a to your computer and use it in GitHub Desktop.
Save Aquazus/4a59206112dfca2f0a6a to your computer and use it in GitHub Desktop.
translateAlternateColorCodes without Bukkit
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