This commit is contained in:
Riley Park 2021-03-10 11:09:23 -08:00
parent 0b25bacfc7
commit e849c51daa

View File

@ -26,20 +26,40 @@ index db2dddd12f54e6d15916c4cee623676541de37fb..1942f5224aaebb18adb591d6f70a419c
+ }
}
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
index f5a24b82b902498bb52eeb11fa351391b3adb31e..de39a489d7a8f9c8731c2ffbbaea500979575056 100644
index 8767c84e6417888cacf1ed76c7e3def73f873d70..7a5ac38c490f5b886a0611b01bd36053bc54a85a 100644
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
@@ -16,7 +16,9 @@ import net.kyori.adventure.text.format.TextDecoration;
@@ -11,12 +11,14 @@ import java.util.regex.Pattern;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextReplacementConfig;
import net.kyori.adventure.text.event.ClickEvent;
-import net.kyori.adventure.text.format.Style;
-import net.kyori.adventure.text.format.TextDecoration;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.IChatBaseComponent;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.ScoreboardTeam;
+import net.minecraft.server.ScoreboardTeamBase;
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;
@@ -108,6 +110,9 @@ public final class ChatProcessor {
@@ -104,10 +106,22 @@ public final class ChatProcessor {
}
private static String legacyDisplayName(final CraftPlayer player) {
+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig.useVanillaScoreboardColoring) {
+ final EntityPlayer ep = player.getHandle();
+ IChatBaseComponent name = ep.getDisplayName();
+ final ScoreboardTeamBase team = ep.getScoreboardTeam();
+ if (team != null) {
+ name = team.getFormattedName(name);
+ }
+ return PaperAdventure.LEGACY_SECTION_UXRC.serialize(PaperAdventure.asAdventure(name)) + ChatColor.RESET;
+ }
return player.getDisplayName();
}
private static Component displayName(final CraftPlayer player) {