Skip to content

Commit

Permalink
feat: add support for uppercase color codes as well as &#rrggbb to la…
Browse files Browse the repository at this point in the history
…ng files
  • Loading branch information
sekwah41 committed Nov 21, 2024
1 parent ce17154 commit 166d48b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static String translate(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) {
Expand Down
4 changes: 3 additions & 1 deletion lang/src/main/resources/lang/en_GB.lang
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
# &n Underline
# &o Italic
# &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.

Expand Down

0 comments on commit 166d48b

Please sign in to comment.