mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Use ChatRenderer.defaultRenderer() when legacy events have not modified the format (#6104)
This commit is contained in:
parent
55ca8ebefe
commit
871bc4e895
2 changed files with 5 additions and 4 deletions
|
@ -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));
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue