forked from MinecraftUtilities/Backend
pls work
This commit is contained in:
parent
b7b788847d
commit
37b048c2a9
@ -70,30 +70,31 @@ public final class ColorUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (char character : input.toCharArray()) {
|
for (char character : input.toCharArray()) {
|
||||||
// Found color symbol, next character is the color code
|
if (character == '§') { // Found color symbol
|
||||||
if (character == '§') {
|
|
||||||
nextIsColor = true;
|
nextIsColor = true;
|
||||||
builder.append(character); // Append the color symbol to the HTML
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (nextIsColor) { // Apply color formatting
|
if (nextIsColor) { // Apply color formatting
|
||||||
// Map the current color to its hex code
|
// Map the current color to its hex code
|
||||||
String color = COLOR_MAP.getOrDefault(Character.toLowerCase(character), "");
|
String color = COLOR_MAP.getOrDefault(Character.toLowerCase(character), "");
|
||||||
builder.append("<span style=\"color:").append(color);
|
// Check if the current character is a valid color code
|
||||||
// Apply additional formatting if necessary
|
if (!color.isEmpty()) {
|
||||||
if (character == 'l') { // Make the char bold
|
builder.append("<span style=\"color:").append(color);
|
||||||
builder.append(";font-weight:bold");
|
// Apply additional formatting if necessary
|
||||||
|
if (character == 'l') { // Make the char bold
|
||||||
|
builder.append(";font-weight:bold");
|
||||||
|
}
|
||||||
|
if (character == 'n') { // Make the char underlined
|
||||||
|
builder.append(";text-decoration:underline");
|
||||||
|
}
|
||||||
|
if (character == 'o') { // Make the char italic
|
||||||
|
builder.append(";font-style:italic");
|
||||||
|
}
|
||||||
|
if (character == 'm') { // Make the char strikethrough
|
||||||
|
builder.append(";text-decoration:line-through");
|
||||||
|
}
|
||||||
|
builder.append("\">");
|
||||||
}
|
}
|
||||||
if (character == 'n') { // Make the char underlined
|
|
||||||
builder.append(";text-decoration:underline");
|
|
||||||
}
|
|
||||||
if (character == 'o') { // Make the char italic
|
|
||||||
builder.append(";font-style:italic");
|
|
||||||
}
|
|
||||||
if (character == 'm') { // Make the char strikethrough
|
|
||||||
builder.append(";text-decoration:line-through");
|
|
||||||
}
|
|
||||||
builder.append("\">");
|
|
||||||
nextIsColor = false; // Reset the flag
|
nextIsColor = false; // Reset the flag
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user