fix html motd
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m32s

This commit is contained in:
Lee 2024-04-14 21:50:44 +01:00
parent f3b1104e93
commit 2e5c8b1ee0

@ -60,11 +60,10 @@ public final class ColorUtils {
@NonNull @NonNull
public static String toHTML(@NonNull String input) { public static String toHTML(@NonNull String input) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("<p>"); // Open the span tag
boolean nextIsColor = false; // Is the next char a color code? boolean nextIsColor = false; // Is the next char a color code?
for (char character : input.toCharArray()) { for (char character : input.toCharArray()) {
// Found color symbol, next color is the color // Found color symbol, next character is the color
if (character == '§') { if (character == '§') {
nextIsColor = true; nextIsColor = true;
continue; continue;
@ -75,9 +74,13 @@ public final class ColorUtils {
nextIsColor = false; nextIsColor = false;
continue; continue;
} }
builder.append(character); // Append the char... if (character == ' ') { // Preserve space character
builder.append("&nbsp;");
} else {
builder.append(character); // Append the char...
}
} }
builder.append("</p>"); // Close the span tag
return builder.toString(); return builder.toString();
} }
} }