forked from MinecraftUtilities/Backend
fix html motd
This commit is contained in:
parent
f3b1104e93
commit
2e5c8b1ee0
@ -60,11 +60,10 @@ public final class ColorUtils {
|
||||
@NonNull
|
||||
public static String toHTML(@NonNull String input) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("<p>"); // 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;
|
||||
}
|
||||
if (character == ' ') { // Preserve space character
|
||||
builder.append(" ");
|
||||
} else {
|
||||
builder.append(character); // Append the char...
|
||||
}
|
||||
builder.append("</p>"); // Close the span tag
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user