mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Respect teams in legacy chat name if configured (#5321)
This commit is contained in:
parent
8a65e6b959
commit
930599fcbf
2 changed files with 9 additions and 3 deletions
|
@ -123,6 +123,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+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..00000000000000000000000000000000
|
|||
+ // 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..00000000000000000000000000000000
|
|||
+ @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..00000000000000000000000000000000
|
|||
+ );
|
||||
+ }
|
||||
+
|
||||
+ 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();
|
||||
+ }
|
||||
|
|
|
@ -29,7 +29,7 @@ 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.event.ClickEvent;
|
||||
@@ -0,0 +0,0 @@ import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.IChatBaseComponent;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
|
Loading…
Reference in a new issue