diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-13 09:36:35 +0000 |
---|---|---|
committer | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-13 09:37:47 +0000 |
commit | 5f2a9eadde3aa899b554a1c8a65e6ae2e86af98e (patch) | |
tree | 3bb6512886dd3e734e08203871f859a9681db8a9 /src/main/java | |
parent | e8efbb8a8762fed89dcb31f78f97693b55bfb2bc (diff) | |
download | craftbukkit-5f2a9eadde3aa899b554a1c8a65e6ae2e86af98e.tar craftbukkit-5f2a9eadde3aa899b554a1c8a65e6ae2e86af98e.tar.gz craftbukkit-5f2a9eadde3aa899b554a1c8a65e6ae2e86af98e.tar.lz craftbukkit-5f2a9eadde3aa899b554a1c8a65e6ae2e86af98e.tar.xz craftbukkit-5f2a9eadde3aa899b554a1c8a65e6ae2e86af98e.zip |
SPIGOT-199: Default to white instead of black for chat messages
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java index 844bf6a7..c3f27f1f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java @@ -131,12 +131,16 @@ public final class CraftChatMessage { } public static String fromComponent(IChatBaseComponent component) { + return fromComponent(component, EnumChatFormat.BLACK); + } + + public static String fromComponent(IChatBaseComponent component, EnumChatFormat defaultColor) { if (component == null) return ""; StringBuilder out = new StringBuilder(); for (IChatBaseComponent c : (Iterable<IChatBaseComponent>) component) { ChatModifier modi = c.getChatModifier(); - out.append(modi.getColor() == null ? EnumChatFormat.BLACK : modi.getColor()); + out.append(modi.getColor() == null ? defaultColor : modi.getColor()); if (modi.isBold()) { out.append(EnumChatFormat.BOLD); } @@ -154,7 +158,7 @@ public final class CraftChatMessage { } out.append(c.getText()); } - return out.toString().replaceFirst("^(ยง0)*", ""); + return out.toString().replaceFirst("^(" + defaultColor + ")*", ""); } private CraftChatMessage() { |