This commit is contained in:
Riley Park 2021-03-10 11:09:23 -08:00
parent 32f7b1fa11
commit 1649b53e54

View file

@ -29,12 +29,19 @@ diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
@@ -0,0 +0,0 @@ import net.kyori.adventure.text.format.TextDecoration;
@@ -0,0 +0,0 @@ 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;
@ -42,6 +49,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ 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) {
+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig.useVanillaScoreboardColoring) {
+ return PaperAdventure.asAdventure(ScoreboardTeam.a(player.getHandle().getScoreboardTeam(), player.getHandle().getDisplayName()));