feat: add support for uppercase color codes as well as &#rrggbb to lang files

This commit is contained in:
Sekwah 2024-11-21 04:31:24 +00:00
parent ce1715436e
commit 166d48bb90
2 changed files with 4 additions and 2 deletions

View File

@ -64,7 +64,7 @@ public class Lang {
} }
public static String convertColors(String s) { public static String convertColors(String s) {
return s.replaceAll("&([0-9a-frk-ox])", "\u00A7$1"); return s.replaceAll("&#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])", "&x&$1&$2&$3&$4&$5&$6").replaceAll("&([0-9a-fA-Fdwrk-ox#])", "\u00A7$1");
} }
public static String translateInsertVariables(String s, Object... args) { public static String translateInsertVariables(String s, Object... args) {

View File

@ -29,7 +29,9 @@
# &n Underline # &n Underline
# &o Italic # &o Italic
# &r Reset # &r Reset
# &x Hex Color (#aa5f10 represented by &x&a&a&5&f&1&0) - Spigot 1.16.1+ #
# &x Hex Color (#aa5f10 represented by &x&r&r&g&g&b&b) - Spigot 1.16.1+
# &# Hex color (#aa5f10 represented by &#rrggbb) - Spigot 1.16.1+
# #
# Some debug messages may not be listed here for translation. # Some debug messages may not be listed here for translation.