Fix click event when vanilla scoreboard name coloring is enabled (#6652)

This commit is contained in:
Jason Penilla 2021-09-30 13:33:19 -05:00
parent 1264c08ef8
commit 4ee912fbfd

View file

@ -46,20 +46,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private static String legacyDisplayName(final CraftPlayer player) {
+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig.useVanillaScoreboardColoring) {
+ final ServerPlayer ep = player.getHandle();
+ net.minecraft.network.chat.Component name = ep.getName();
+ final Team team = ep.getTeam();
+ if (team != null) {
+ name = team.getFormattedName(name);
+ }
+ return PaperAdventure.LEGACY_SECTION_UXRC.serialize(PaperAdventure.asAdventure(name)) + ChatColor.RESET;
+ 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 PaperAdventure.asAdventure(PlayerTeam.formatNameForTeam(player.getHandle().getTeam(), player.getHandle().getName()));
+ return player.teamDisplayName();
+ }
return player.displayName();
}