diff --git a/src/main/java/xyz/mcutils/backend/common/ColorUtils.java b/src/main/java/xyz/mcutils/backend/common/ColorUtils.java index 61c8b8b..22e7583 100644 --- a/src/main/java/xyz/mcutils/backend/common/ColorUtils.java +++ b/src/main/java/xyz/mcutils/backend/common/ColorUtils.java @@ -60,11 +60,10 @@ public final class ColorUtils { @NonNull public static String toHTML(@NonNull String input) { StringBuilder builder = new StringBuilder(); - builder.append("

"); // Open the span tag boolean nextIsColor = false; // Is the next char a color code? for (char character : input.toCharArray()) { - // Found color symbol, next color is the color + // Found color symbol, next character is the color if (character == 'ยง') { nextIsColor = true; continue; @@ -75,9 +74,13 @@ public final class ColorUtils { nextIsColor = false; continue; } - builder.append(character); // Append the char... + if (character == ' ') { // Preserve space character + builder.append(" "); + } else { + builder.append(character); // Append the char... + } } - builder.append("

"); // Close the span tag return builder.toString(); } + } \ No newline at end of file