From 6b75dac6f43dd55dc5ed4f850b696a3b88d37839 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 6 Apr 2016 01:10:26 -0500 Subject: [PATCH] Add basic support for using vanilla style, world-based, scoreboard name coloring Closes GH-188 --- ...nilla-per-world-scoreboard-coloring-.patch | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Spigot-Server-Patches/0130-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch diff --git a/Spigot-Server-Patches/0130-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/0130-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch new file mode 100644 index 000000000..cb1612103 --- /dev/null +++ b/Spigot-Server-Patches/0130-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -0,0 +1,53 @@ +From f46589b84ced4464830f16cc794803837e0c2573 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Wed, 6 Apr 2016 01:04:23 -0500 +Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 275bf10..ad69ed3 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -318,4 +318,9 @@ public class PaperWorldConfig { + keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 8)) * 16); + log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16)); + } ++ ++ public boolean useVanillaScoreboardColoring; ++ private void useVanillaScoreboardColoring() { ++ useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false); ++ } + } +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index ffbe81d..a9a908f 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -1345,15 +1345,21 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + return; + } + +- 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())); ++ if (this.player.getWorld().paperConfig.useVanillaScoreboardColoring) { ++ baseComponent = new ChatMessage(event.getFormat(), ScoreboardTeam.getPlayerDisplayName(this.player.aO(), player.getDisplayName()), event.getMessage()); ++ } ++ // Paper end ++ minecraftServer.console.sendMessage(baseComponent.toPlainText()); + 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 + } + } + } +-- +2.8.0 +