Skip to content

Commit 65554a2

Browse files
committed
Explore RGB ANSI code regex to fix matching
1 parent f528bed commit 65554a2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/com/laytonsmith/core/Static.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,8 @@ public static String MCToANSIColors(String mes) {
11841184
}
11851185

11861186
// Convert RGB color codes to ANSI RGB color codes. Note that Windows command prompt ignores this.
1187-
mes = Pattern.compile("(?i)§x(?:§([a-f0-9])){6}").matcher(mes).replaceAll((MatchResult res) -> {
1187+
mes = Pattern.compile("(?i)§x§([a-f0-9])§([a-f0-9])§([a-f0-9])§([a-f0-9])§([a-f0-9])§([a-f0-9])")
1188+
.matcher(mes).replaceAll((MatchResult res) -> {
11881189
int red = Integer.parseInt(res.group(1) + res.group(2), 16);
11891190
int green = Integer.parseInt(res.group(3) + res.group(4), 16);
11901191
int blue = Integer.parseInt(res.group(5) + res.group(6), 16);

0 commit comments

Comments
 (0)