From 2e5c8b1ee07227b1c1ff356310a0d845aca5512b Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 14 Apr 2024 21:50:44 +0100 Subject: [PATCH] fix html motd --- .../java/xyz/mcutils/backend/common/ColorUtils.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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