mirror of
https://github.com/PaperMC/Paper.git
synced 2024-08-31 01:00:22 +02:00
58 lines
2.8 KiB
Diff
58 lines
2.8 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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 53692c9a72a75cb5280165a99c95667928eec753..91d9717c88d7a413a71cc0897402dac0013fea4d 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -295,4 +295,9 @@ public class PaperWorldConfig {
|
|
grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate));
|
|
log("Grass Spread Tick Rate: " + grassUpdateRate);
|
|
}
|
|
+
|
|
+ public boolean useVanillaScoreboardColoring;
|
|
+ private void useVanillaScoreboardColoring() {
|
|
+ useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
index 0bc2c2ef9312ebcc32dacdd2ba9f17d2ba072586..9507ba43cacc31c02423a4f576feda32291101e7 100644
|
|
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
@@ -18,6 +18,8 @@ import net.kyori.adventure.text.event.ClickEvent;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.server.level.ServerPlayer;
|
|
import org.bukkit.Bukkit;
|
|
+import org.bukkit.ChatColor;
|
|
+import org.bukkit.craftbukkit.CraftWorld;
|
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
import org.bukkit.craftbukkit.util.LazyPlayerSet;
|
|
import org.bukkit.craftbukkit.util.Waitable;
|
|
@@ -189,10 +191,16 @@ public final class ChatProcessor {
|
|
}
|
|
|
|
private static String legacyDisplayName(final CraftPlayer player) {
|
|
+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig.useVanillaScoreboardColoring) {
|
|
+ return PaperAdventure.LEGACY_SECTION_UXRC.serialize(player.teamDisplayName()) + ChatColor.RESET;
|
|
+ }
|
|
return player.getDisplayName();
|
|
}
|
|
|
|
private static Component displayName(final CraftPlayer player) {
|
|
+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig.useVanillaScoreboardColoring) {
|
|
+ return player.teamDisplayName();
|
|
+ }
|
|
return player.displayName();
|
|
}
|
|
|