Respect teams in legacy chat name if configured (#5321)
This commit is contained in:
parent
b31089a929
commit
e65bd35a12
|
@ -106,10 +106,10 @@ index 0000000000000000000000000000000000000000..a2acd31dce4461338a8baa96e03df36a
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a8bc84d476093e6b39564450564f676adccde898
|
||||
index 0000000000000000000000000000000000000000..f5a24b82b902498bb52eeb11fa351391b3adb31e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
@@ -0,0 +1,212 @@
|
||||
@@ -0,0 +1,218 @@
|
||||
+package io.papermc.paper.adventure;
|
||||
+
|
||||
+import io.papermc.paper.chat.ChatFormatter;
|
||||
|
@ -123,6 +123,8 @@ index 0000000000000000000000000000000000000000..a8bc84d476093e6b39564450564f676a
|
|||
+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;
|
||||
|
@ -171,7 +173,7 @@ index 0000000000000000000000000000000000000000..a8bc84d476093e6b39564450564f676a
|
|||
+ // continuing from AsyncPlayerChatEvent (without PlayerChatEvent)
|
||||
+ event -> {
|
||||
+ final AsyncChatEvent ae = this.createAsync(
|
||||
+ legacyFormatter(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()),
|
||||
+ legacyFormatter(event.getFormat(), legacyDisplayName((CraftPlayer) event.getPlayer()), event.getMessage()),
|
||||
+ event.getRecipients(),
|
||||
+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage())
|
||||
+ );
|
||||
|
@ -189,7 +191,7 @@ index 0000000000000000000000000000000000000000..a8bc84d476093e6b39564450564f676a
|
|||
+ @Override
|
||||
+ protected Void evaluate() {
|
||||
+ final ChatEvent se = ChatProcessor.this.createSync(
|
||||
+ legacyFormatter(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()),
|
||||
+ legacyFormatter(event.getFormat(), legacyDisplayName((CraftPlayer) event.getPlayer()), event.getMessage()),
|
||||
+ event.getRecipients(),
|
||||
+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage())
|
||||
+ );
|
||||
|
@ -213,6 +215,10 @@ index 0000000000000000000000000000000000000000..a8bc84d476093e6b39564450564f676a
|
|||
+ );
|
||||
+ }
|
||||
+
|
||||
+ private static String legacyDisplayName(final CraftPlayer player) {
|
||||
+ return PaperAdventure.LEGACY_SECTION_UXRC.serialize(Component.empty().append(displayName(player)));
|
||||
+ }
|
||||
+
|
||||
+ private static Component displayName(final CraftPlayer player) {
|
||||
+ return player.displayName();
|
||||
+ }
|
||||
|
|
|
@ -26,10 +26,10 @@ 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 a8bc84d476093e6b39564450564f676adccde898..4934b732a602e0c9aba4957459490455b4b368b2 100644
|
||||
index f5a24b82b902498bb52eeb11fa351391b3adb31e..de39a489d7a8f9c8731c2ffbbaea500979575056 100644
|
||||
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
@@ -14,7 +14,9 @@ import net.kyori.adventure.text.event.ClickEvent;
|
||||
@@ -16,7 +16,9 @@ import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.IChatBaseComponent;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
@ -39,7 +39,7 @@ index a8bc84d476093e6b39564450564f676adccde898..4934b732a602e0c9aba4957459490455
|
|||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.util.LazyPlayerSet;
|
||||
import org.bukkit.craftbukkit.util.Waitable;
|
||||
@@ -102,6 +104,9 @@ public final class ChatProcessor {
|
||||
@@ -108,6 +110,9 @@ public final class ChatProcessor {
|
||||
}
|
||||
|
||||
private static Component displayName(final CraftPlayer player) {
|
||||
|
|
Loading…
Reference in New Issue