From b7b788847d951b473db17e92846485711a637465 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 16 Apr 2024 20:58:03 +0100 Subject: [PATCH] support more formatting --- src/main/java/xyz/mcutils/backend/common/ColorUtils.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/xyz/mcutils/backend/common/ColorUtils.java b/src/main/java/xyz/mcutils/backend/common/ColorUtils.java index 580cd51..256c6aa 100644 --- a/src/main/java/xyz/mcutils/backend/common/ColorUtils.java +++ b/src/main/java/xyz/mcutils/backend/common/ColorUtils.java @@ -70,14 +70,17 @@ public final class ColorUtils { } for (char character : input.toCharArray()) { - // Found color symbol, next color is the color + // Found color symbol, next character is the color code if (character == 'ยง') { nextIsColor = true; + builder.append(character); // Append the color symbol to the HTML continue; } - if (nextIsColor && !String.valueOf(character).equals("|")) { // Map the current color to its hex code + if (nextIsColor) { // Apply color formatting + // Map the current color to its hex code String color = COLOR_MAP.getOrDefault(Character.toLowerCase(character), ""); builder.append(""); - nextIsColor = false; + nextIsColor = false; // Reset the flag continue; } if (character == ' ') { // Preserve space character