From 871bc4e895a45250dbf05c8c1937332fc9bf1e22 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Wed, 13 Oct 2021 04:00:40 -0500 Subject: [PATCH] Use ChatRenderer.defaultRenderer() when legacy events have not modified the format (#6104) --- patches/server/Adventure.patch | 4 ++++ ...ption-to-use-vanilla-per-world-scoreboard-coloring-.patch | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 9df5fa0f04..5d8e23a1b7 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -162,6 +162,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }) + .build(); + // copied from adventure-text-serializer-legacy --> ++ private static final String DEFAULT_LEGACY_FORMAT = "<%1$s> %2$s"; // copied from PlayerChatEvent/AsyncPlayerChatEvent + final MinecraftServer server; + final ServerPlayer player; + final String message; @@ -316,6 +317,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + private static ChatRenderer legacyRenderer(final String format) { ++ if (DEFAULT_LEGACY_FORMAT.equals(format)) { ++ return ChatRenderer.defaultRenderer(); ++ } + return ChatRenderer.viewerUnaware((player, displayName, message) -> PaperAdventure.LEGACY_SECTION_UXRC.deserialize(String.format(format, legacyDisplayName((CraftPlayer) player), PaperAdventure.LEGACY_SECTION_UXRC.serialize(message))).replaceText(URL_REPLACEMENT_CONFIG)); + } + diff --git a/patches/server/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/patches/server/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 0306e39437..b8b0ba4ad5 100644 --- a/patches/server/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/patches/server/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -29,12 +29,9 @@ 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.TextReplacementConfig; - import net.kyori.adventure.text.event.ClickEvent; +@@ -0,0 +0,0 @@ import net.kyori.adventure.text.event.ClickEvent; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; -+import net.minecraft.world.scores.PlayerTeam; -+import net.minecraft.world.scores.Team; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.CraftWorld;