2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
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
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
2022-12-08 17:32:29 +01:00
|
|
|
index 8b7b140ac0326ffccd51684e283647148de30647..fd5cbb45e9894b7895ea488e2b9876c0391f6f11 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
|
|
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
2022-12-08 17:32:29 +01:00
|
|
|
@@ -23,8 +23,10 @@ import net.minecraft.network.chat.PlayerChatMessage;
|
2022-08-01 21:34:55 +02:00
|
|
|
import net.minecraft.resources.ResourceKey;
|
2021-06-11 14:02:28 +02:00
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
|
import net.minecraft.server.level.ServerPlayer;
|
|
|
|
+import org.bukkit.ChatColor;
|
2022-08-01 21:34:55 +02:00
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.command.ConsoleCommandSender;
|
2021-06-11 14:02:28 +02:00
|
|
|
+import org.bukkit.craftbukkit.CraftWorld;
|
|
|
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
|
|
import org.bukkit.craftbukkit.util.LazyPlayerSet;
|
|
|
|
import org.bukkit.craftbukkit.util.Waitable;
|
2022-12-08 17:32:29 +01:00
|
|
|
@@ -326,10 +328,16 @@ public final class ChatProcessor {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2022-08-01 21:34:55 +02:00
|
|
|
static String legacyDisplayName(final CraftPlayer player) {
|
2022-06-09 10:51:45 +02:00
|
|
|
+ if (((org.bukkit.craftbukkit.CraftWorld) player.getWorld()).getHandle().paperConfig().scoreboards.useVanillaWorldScoreboardNameColoring) {
|
2022-08-01 21:34:55 +02:00
|
|
|
+ return legacySection().serialize(player.teamDisplayName()) + ChatColor.RESET;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
return player.getDisplayName();
|
|
|
|
}
|
|
|
|
|
2022-08-01 21:34:55 +02:00
|
|
|
static Component displayName(final CraftPlayer player) {
|
2022-06-09 10:51:45 +02:00
|
|
|
+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig().scoreboards.useVanillaWorldScoreboardNameColoring) {
|
2021-09-30 20:33:19 +02:00
|
|
|
+ return player.teamDisplayName();
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
return player.displayName();
|
|
|
|
}
|
|
|
|
|