From b9f596b8d291a2a64379be09baf5f5b575071585 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> 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 | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch diff --git a/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch new file mode 100644 index 0000000000..3774466388 --- /dev/null +++ b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -0,0 +0,0 @@ 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 + } + } + } +-- \ No newline at end of file