mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 14:38:49 +00:00
Fix color parsing, fixes #34
This commit is contained in:
1 parent
cf946b332f
commit
5a8f3f5a81
1 file changed
+7
-11
@@ -126,10 +126,12 @@ public class CarbonChatChannel extends ChatChannel {
|
||||
continue;
|
||||
}
|
||||
|
||||
TextColor targetColor = getColor(target);
|
||||
|
||||
TextComponent formattedMessage = (TextComponent) carbonChat.getAdventureManager().processMessage(formatEvent.getFormat(),
|
||||
"br", "\n",
|
||||
"displayname", displayName,
|
||||
"color", "<" + getColor(target).asHexString() + ">",
|
||||
"color", "<" + targetColor.asHexString() + ">",
|
||||
"phase", Long.toString(System.currentTimeMillis() % 25),
|
||||
"server", carbonChat.getConfig().getString("server-name", "Server"),
|
||||
"message", formatEvent.getMessage());
|
||||
@@ -138,7 +140,7 @@ public class CarbonChatChannel extends ChatChannel {
|
||||
String prefix = processPlaceholders(user, carbonChat.getConfig().getString("spy-prefix"));
|
||||
|
||||
formattedMessage = (TextComponent) MiniMessage.get().parse(prefix, "color",
|
||||
getColor(target).asHexString()).append(formattedMessage);
|
||||
targetColor.asHexString()).append(formattedMessage);
|
||||
}
|
||||
|
||||
ChatComponentEvent newEvent = new ChatComponentEvent(user, target, this, formattedMessage,
|
||||
@@ -342,16 +344,10 @@ public class CarbonChatChannel extends ChatChannel {
|
||||
}
|
||||
}
|
||||
|
||||
if (color.startsWith("&")) {
|
||||
LegacyFormat legacyFormat = LegacyComponentSerializer.parseChar(color.charAt(1));
|
||||
if (color.contains("&") || color.contains("§")) {
|
||||
color = color.replace("&", "§");
|
||||
|
||||
if (legacyFormat != null) {
|
||||
TextColor legacyColor = legacyFormat.color();
|
||||
|
||||
if (legacyColor != null) {
|
||||
return legacyColor;
|
||||
}
|
||||
}
|
||||
return LegacyComponentSerializer.legacySection().deserialize(color).color();
|
||||
}
|
||||
|
||||
TextColor textColor = TextColor.fromHexString(color);
|
||||
|
||||
Reference in new issue
Block a user