From 166d48bb90de533e71e51645be47ddf73b603d6c Mon Sep 17 00:00:00 2001 From: Sekwah Date: Thu, 21 Nov 2024 04:31:24 +0000 Subject: [PATCH] feat: add support for uppercase color codes as well as &#rrggbb to lang files --- .../main/java/com/sekwah/advancedportals/core/util/Lang.java | 2 +- lang/src/main/resources/lang/en_GB.lang | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/sekwah/advancedportals/core/util/Lang.java b/core/src/main/java/com/sekwah/advancedportals/core/util/Lang.java index e115e443..ac12f736 100644 --- a/core/src/main/java/com/sekwah/advancedportals/core/util/Lang.java +++ b/core/src/main/java/com/sekwah/advancedportals/core/util/Lang.java @@ -64,7 +64,7 @@ public class Lang { } 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) { diff --git a/lang/src/main/resources/lang/en_GB.lang b/lang/src/main/resources/lang/en_GB.lang index c3a26c3c..92395ad9 100644 --- a/lang/src/main/resources/lang/en_GB.lang +++ b/lang/src/main/resources/lang/en_GB.lang @@ -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.