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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2022-06-06 02:17:27 +02:00
|
|
|
index 8dcb136f3f77bc69d5976cc17ecdafb91b5be1bc..8381b1c9ffa5d9f28281336d5a3df4d01253dd92 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2022-06-06 02:17:27 +02:00
|
|
|
@@ -310,4 +310,9 @@ public class PaperWorldConfig {
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
2022-05-26 21:12:14 +02:00
|
|
|
index 3526bc0b6ad590776124966ea907fe2467cbbf5f..65005e9818ef603724ff8f8041f617f1e602a868 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-05-26 21:12:14 +02:00
|
|
|
@@ -16,6 +16,8 @@ import net.kyori.adventure.text.event.ClickEvent;
|
|
|
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
2021-06-11 14:02:28 +02:00
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
|
import net.minecraft.server.level.ServerPlayer;
|
|
|
|
+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;
|
2022-05-26 21:12:14 +02:00
|
|
|
@@ -154,10 +156,16 @@ public final class ChatProcessor {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private static String legacyDisplayName(final CraftPlayer player) {
|
|
|
|
+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig.useVanillaScoreboardColoring) {
|
2022-05-26 21:12:14 +02:00
|
|
|
+ return LegacyComponentSerializer.legacySection().serialize(player.teamDisplayName()) + ChatColor.RESET;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
return player.getDisplayName();
|
|
|
|
}
|
|
|
|
|
|
|
|
private static Component displayName(final CraftPlayer player) {
|
|
|
|
+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig.useVanillaScoreboardColoring) {
|
2021-09-30 20:33:19 +02:00
|
|
|
+ return player.teamDisplayName();
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
return player.displayName();
|
|
|
|
}
|
|
|
|
|