Fix scoreboard vanilla colors not working in chat

This commit is contained in:
William Blake Galbreath 2020-07-31 16:20:29 +01:00 committed by Shane Freeder
parent 3cf2c52d95
commit 58a745eba0
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
1 changed files with 2 additions and 2 deletions

View File

@ -26,7 +26,7 @@ index fe2c8001897dc6d66ce0d24ddb1a5d3b79810294..538e6751f3bda77ba32256158d2a6a25
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index e65aa13ed4d751c7eec576b75496683d8b95d06f..c865aab4f56d6b0544ef66a35ebf58e48c8afbb8 100644 index 530b5d4be48adae8d7d31e886b62b543de7d97ad..b6d1637607b5bd2339e2ddebaad89898ecc83c78 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1693,7 +1693,16 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -1693,7 +1693,16 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -39,7 +39,7 @@ index e65aa13ed4d751c7eec576b75496683d8b95d06f..c865aab4f56d6b0544ef66a35ebf58e4
+ if (this.player.getWorld().paperConfig.useVanillaScoreboardColoring) { + if (this.player.getWorld().paperConfig.useVanillaScoreboardColoring) {
+ IChatBaseComponent nameFromTeam = ScoreboardTeam.a(this.player.getScoreboardTeam(), ((CraftPlayer) player).getHandle().getDisplayName()); + IChatBaseComponent nameFromTeam = ScoreboardTeam.a(this.player.getScoreboardTeam(), ((CraftPlayer) player).getHandle().getDisplayName());
+ // Explicitly add a RESET here, vanilla uses components for this now... + // Explicitly add a RESET here, vanilla uses components for this now...
+ displayName = CraftChatMessage.fromComponent(nameFromTeam) + org.bukkit.ChatColor.RESET; + displayName = new net.md_5.bungee.api.chat.TextComponent(net.md_5.bungee.chat.ComponentSerializer.parse(IChatBaseComponent.ChatSerializer.componentToJson(nameFromTeam))).toLegacyText() + org.bukkit.ChatColor.RESET;
+ } + }
+ +
+ s = String.format(event.getFormat(), displayName, event.getMessage()); + s = String.format(event.getFormat(), displayName, event.getMessage());