mirror of
https://github.com/PaperMC/Paper.git
synced 2024-08-27 15:09:34 +02:00
45 lines
2.1 KiB
Diff
45 lines
2.1 KiB
Diff
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
|
|
index 45830cf2b42c2c983cef922c6355e5d6a7cfb982..4d9bc4a62ebae0f3707900503576c64733de639f 100644
|
|
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
@@ -29,7 +29,9 @@ import net.minecraft.network.chat.PlayerChatMessage;
|
|
import net.minecraft.resources.ResourceKey;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.server.level.ServerPlayer;
|
|
+import org.bukkit.ChatColor;
|
|
import org.bukkit.command.ConsoleCommandSender;
|
|
+import org.bukkit.craftbukkit.CraftWorld;
|
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
import org.bukkit.craftbukkit.util.LazyPlayerSet;
|
|
import org.bukkit.craftbukkit.util.Waitable;
|
|
@@ -365,10 +367,16 @@ public final class ChatProcessor {
|
|
}
|
|
|
|
static String legacyDisplayName(final CraftPlayer player) {
|
|
+ if (((org.bukkit.craftbukkit.CraftWorld) player.getWorld()).getHandle().paperConfig().scoreboards.useVanillaWorldScoreboardNameColoring) {
|
|
+ return legacySection().serialize(player.teamDisplayName()) + ChatColor.RESET;
|
|
+ }
|
|
return player.getDisplayName();
|
|
}
|
|
|
|
static Component displayName(final CraftPlayer player) {
|
|
+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig().scoreboards.useVanillaWorldScoreboardNameColoring) {
|
|
+ return player.teamDisplayName();
|
|
+ }
|
|
return player.displayName();
|
|
}
|
|
|