Send post ChatEvent messages as MessageType.CHAT

Fixes narrator issue #5450
This commit is contained in:
Professor Bloodstone 2021-04-04 22:43:11 +02:00 committed by Mariell Hoversholm
parent d151611145
commit a111b13655
2 changed files with 8 additions and 6 deletions

View file

@ -105,10 +105,10 @@ index 0000000000000000000000000000000000000000..89597b4a3064c3c6001c7e927a848ee7
+} +}
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java 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 new file mode 100644
index 0000000000000000000000000000000000000000..8774f5f8d1c6dbc2c504dc028368e8ab8cd3c38d index 0000000000000000000000000000000000000000..75c36e772be93c9808cd8b72410ad8baa3d47006
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
@@ -0,0 +1,212 @@ @@ -0,0 +1,214 @@
+package io.papermc.paper.adventure; +package io.papermc.paper.adventure;
+ +
+import io.papermc.paper.chat.ChatComposer; +import io.papermc.paper.chat.ChatComposer;
@ -119,6 +119,8 @@ index 0000000000000000000000000000000000000000..8774f5f8d1c6dbc2c504dc028368e8ab
+import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutionException;
+import java.util.function.Consumer; +import java.util.function.Consumer;
+import java.util.regex.Pattern; +import java.util.regex.Pattern;
+
+import net.kyori.adventure.audience.MessageType;
+import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.TextReplacementConfig; +import net.kyori.adventure.text.TextReplacementConfig;
+import net.kyori.adventure.text.event.ClickEvent; +import net.kyori.adventure.text.event.ClickEvent;
@ -273,7 +275,7 @@ index 0000000000000000000000000000000000000000..8774f5f8d1c6dbc2c504dc028368e8ab
+ } + }
+ } else { + } else {
+ for (final Player recipient : event.recipients()) { + for (final Player recipient : event.recipients()) {
+ recipient.sendMessage(player, message); + recipient.sendMessage(player, message, MessageType.CHAT);
+ } + }
+ } + }
+ } + }

View file

@ -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 diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
index ed00e5e825856e790da467f429d026772e6303bd..472adbd2aa2a9e1d8d481749ba92c3a290a5fa36 100644 index 75c36e772be93c9808cd8b72410ad8baa3d47006..636c60c7a8d674150fad0579c642cd037debde28 100644
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java --- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
@@ -14,7 +14,11 @@ import net.kyori.adventure.text.event.ClickEvent; @@ -16,7 +16,11 @@ import net.kyori.adventure.text.event.ClickEvent;
import net.minecraft.network.chat.IChatBaseComponent; import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.EntityPlayer; import net.minecraft.server.level.EntityPlayer;
@ -41,7 +41,7 @@ index ed00e5e825856e790da467f429d026772e6303bd..472adbd2aa2a9e1d8d481749ba92c3a2
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.util.LazyPlayerSet; import org.bukkit.craftbukkit.util.LazyPlayerSet;
import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.craftbukkit.util.Waitable;
@@ -176,10 +180,22 @@ public final class ChatProcessor { @@ -178,10 +182,22 @@ public final class ChatProcessor {
} }
private static String legacyDisplayName(final CraftPlayer player) { private static String legacyDisplayName(final CraftPlayer player) {