2019-07-16 22:09:32 +00:00
|
|
|
From e40c08b3fbb3d17216aa807c6111cc15157fc0d4 Mon Sep 17 00:00:00 2001
|
2018-07-15 01:53:17 +00:00
|
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
|
|
Date: Wed, 6 Apr 2016 01:04:23 -0500
|
|
|
|
Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names
|
|
|
|
|
2018-11-25 17:16:01 +00:00
|
|
|
This change is basically a bandaid to fix CB's complete and utter lack
|
|
|
|
of support for vanilla scoreboard name modifications.
|
|
|
|
|
|
|
|
In the future, finding a way to merge the vanilla expectations in with
|
|
|
|
bukkit's concept of a display name would be preferable. There was a PR
|
|
|
|
for this on CB at one point but I can't find it. We may need to do this
|
|
|
|
ourselves at some point in the future.
|
2018-07-15 01:53:17 +00:00
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2019-07-16 22:09:32 +00:00
|
|
|
index 271410337..aeeb7c24e 100644
|
2018-07-15 01:53:17 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2019-07-03 20:44:07 +00:00
|
|
|
@@ -245,4 +245,9 @@ public class PaperWorldConfig {
|
2019-04-27 03:05:36 +00:00
|
|
|
grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate));
|
|
|
|
log("Grass Spread Tick Rate: " + grassUpdateRate);
|
2018-07-15 01:53:17 +00:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ 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
|
2019-07-16 22:09:32 +00:00
|
|
|
index a6bb6a511..c4384bbee 100644
|
2018-07-15 01:53:17 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2019-07-16 22:09:32 +00:00
|
|
|
@@ -1666,7 +1666,16 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
2018-07-15 01:53:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
- s = 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) {
|
2018-12-17 05:18:06 +00:00
|
|
|
+ IChatBaseComponent nameFromTeam = ScoreboardTeam.a(this.player.getScoreboardTeam(),((CraftPlayer) player).getHandle().getDisplayName());
|
2018-07-25 08:58:03 +00:00
|
|
|
+ // Explicitly add a RESET here, vanilla uses components for this now...
|
2018-11-25 17:16:01 +00:00
|
|
|
+ displayName = CraftChatMessage.fromComponent(nameFromTeam, EnumChatFormat.WHITE) + org.bukkit.ChatColor.RESET;
|
2018-07-15 01:53:17 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ s = String.format(event.getFormat(), displayName, event.getMessage());
|
|
|
|
+ // Paper end
|
|
|
|
minecraftServer.console.sendMessage(s);
|
|
|
|
if (((LazyPlayerSet) event.getRecipients()).isLazy()) {
|
|
|
|
for (Object recipient : minecraftServer.getPlayerList().players) {
|
2018-11-25 17:16:01 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
2019-07-16 22:09:32 +00:00
|
|
|
index cce5305fb..d368b3975 100644
|
2018-11-25 17:16:01 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
2019-05-14 02:20:58 +00:00
|
|
|
@@ -177,7 +177,7 @@ public abstract class PlayerList {
|
2018-11-25 17:16:01 +00:00
|
|
|
}
|
2019-04-27 03:05:36 +00:00
|
|
|
// CraftBukkit start
|
2018-11-25 17:16:01 +00:00
|
|
|
chatmessage.a(EnumChatFormat.YELLOW);
|
2019-04-27 03:05:36 +00:00
|
|
|
- String joinMessage = CraftChatMessage.fromComponent(chatmessage);
|
|
|
|
+ String joinMessage = CraftChatMessage.fromComponent(chatmessage, EnumChatFormat.WHITE);
|
|
|
|
|
2018-11-25 17:16:01 +00:00
|
|
|
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
|
2019-04-27 03:05:36 +00:00
|
|
|
this.players.add(entityplayer);
|
2018-07-15 01:53:17 +00:00
|
|
|
--
|
2019-06-25 19:18:50 +00:00
|
|
|
2.22.0
|
2018-07-15 01:53:17 +00:00
|
|
|
|