Simplify vanilla scoreboard nickname coloring patch

Closes GH-195
This commit is contained in:
Zach Brown 2016-04-07 17:31:06 -05:00
parent 85a924b7dd
commit d6b1996ab3

View file

@ -27,25 +27,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
- minecraftServer.console.sendMessage(s);
+ // Paper start - (Meh) Support for vanilla world scoreboard name coloring
+ //s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
+ IChatBaseComponent baseComponent = new ChatMessage(String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()));
+ // Paper Start - (Meh) Support for vanilla world scoreboard name coloring
+ String displayName = event.getPlayer().getDisplayName();
+ if (this.player.getWorld().paperConfig.useVanillaScoreboardColoring) {
+ baseComponent = new ChatMessage(event.getFormat(), ScoreboardTeam.getPlayerDisplayName(this.player.aO(), player.getDisplayName()), event.getMessage());
+ displayName = ScoreboardTeam.getPlayerDisplayName(this.player.aO(), player.getDisplayName());
+ }
+
+ s = String.format(event.getFormat(), displayName, event.getMessage());
+ // Paper end
+ minecraftServer.console.sendMessage(baseComponent.toPlainText());
minecraftServer.console.sendMessage(s);
if (((LazyPlayerSet) event.getRecipients()).isLazy()) {
for (Object recipient : minecraftServer.getPlayerList().players) {
- ((EntityPlayer) recipient).sendMessage(CraftChatMessage.fromString(s));
+ ((EntityPlayer) recipient).sendMessage(baseComponent); // Paper - (Meh) Support for vanilla world scoreboard name coloring
}
} else {
for (Player recipient : event.getRecipients()) {
- recipient.sendMessage(s);
+ ((CraftPlayer) recipient).getHandle().sendMessage(baseComponent); // Paper - (Meh) Support for vanilla world scoreboard name coloring
}
}
}
--