Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
fix #5292 with help from @JRoy
Dieser Commit ist enthalten in:
Ursprung
9907cedecb
Commit
60e92c061b
@ -106,16 +106,17 @@ 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
|
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..d7945e7340f406fbf21a1bd67f9c167a309d0fb7
|
index 0000000000000000000000000000000000000000..a8bc84d476093e6b39564450564f676adccde898
|
||||||
--- /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,209 @@
|
@@ -0,0 +1,212 @@
|
||||||
+package io.papermc.paper.adventure;
|
+package io.papermc.paper.adventure;
|
||||||
+
|
+
|
||||||
+import io.papermc.paper.chat.ChatFormatter;
|
+import io.papermc.paper.chat.ChatFormatter;
|
||||||
+import io.papermc.paper.event.player.AbstractChatEvent;
|
+import io.papermc.paper.event.player.AbstractChatEvent;
|
||||||
+import io.papermc.paper.event.player.AsyncChatEvent;
|
+import io.papermc.paper.event.player.AsyncChatEvent;
|
||||||
+import io.papermc.paper.event.player.ChatEvent;
|
+import io.papermc.paper.event.player.ChatEvent;
|
||||||
|
+import java.util.Set;
|
||||||
+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;
|
||||||
@ -171,6 +172,7 @@ index 0000000000000000000000000000000000000000..d7945e7340f406fbf21a1bd67f9c167a
|
|||||||
+ event -> {
|
+ event -> {
|
||||||
+ final AsyncChatEvent ae = this.createAsync(
|
+ final AsyncChatEvent ae = this.createAsync(
|
||||||
+ legacyFormatter(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()),
|
+ legacyFormatter(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()),
|
||||||
|
+ event.getRecipients(),
|
||||||
+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage())
|
+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage())
|
||||||
+ );
|
+ );
|
||||||
+ ae.setCancelled(event.isCancelled()); // propagate cancelled state
|
+ ae.setCancelled(event.isCancelled()); // propagate cancelled state
|
||||||
@ -188,6 +190,7 @@ index 0000000000000000000000000000000000000000..d7945e7340f406fbf21a1bd67f9c167a
|
|||||||
+ protected Void evaluate() {
|
+ protected Void evaluate() {
|
||||||
+ final ChatEvent se = ChatProcessor.this.createSync(
|
+ final ChatEvent se = ChatProcessor.this.createSync(
|
||||||
+ legacyFormatter(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()),
|
+ legacyFormatter(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()),
|
||||||
|
+ event.getRecipients(),
|
||||||
+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage())
|
+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage())
|
||||||
+ );
|
+ );
|
||||||
+ se.setCancelled(event.isCancelled()); // propagate cancelled state
|
+ se.setCancelled(event.isCancelled()); // propagate cancelled state
|
||||||
@ -199,7 +202,7 @@ index 0000000000000000000000000000000000000000..d7945e7340f406fbf21a1bd67f9c167a
|
|||||||
+ },
|
+ },
|
||||||
+ // no legacy events called, all nice and fresh!
|
+ // no legacy events called, all nice and fresh!
|
||||||
+ () -> {
|
+ () -> {
|
||||||
+ final AsyncChatEvent ae = this.createAsync(ChatFormatter.DEFAULT, Component.text(this.message).replaceText(URL_REPLACEMENT_CONFIG));
|
+ final AsyncChatEvent ae = this.createAsync(ChatFormatter.DEFAULT, new LazyPlayerSet(this.server), Component.text(this.message).replaceText(URL_REPLACEMENT_CONFIG));
|
||||||
+ post(ae);
|
+ post(ae);
|
||||||
+ if (listenersOnSyncEvent) {
|
+ if (listenersOnSyncEvent) {
|
||||||
+ this.continueWithSyncFromWhereAsyncLeftOff(ae);
|
+ this.continueWithSyncFromWhereAsyncLeftOff(ae);
|
||||||
@ -222,7 +225,7 @@ index 0000000000000000000000000000000000000000..d7945e7340f406fbf21a1bd67f9c167a
|
|||||||
+ this.queueIfAsyncOrRunImmediately(new Waitable<Void>() {
|
+ this.queueIfAsyncOrRunImmediately(new Waitable<Void>() {
|
||||||
+ @Override
|
+ @Override
|
||||||
+ protected Void evaluate() {
|
+ protected Void evaluate() {
|
||||||
+ final ChatEvent se = ChatProcessor.this.createSync(ae.formatter(), ae.message());
|
+ final ChatEvent se = ChatProcessor.this.createSync(ae.formatter(), ae.recipients(), ae.message());
|
||||||
+ se.setCancelled(ae.isCancelled()); // propagate cancelled state
|
+ se.setCancelled(ae.isCancelled()); // propagate cancelled state
|
||||||
+ post(se);
|
+ post(se);
|
||||||
+ ChatProcessor.this.complete(se);
|
+ ChatProcessor.this.complete(se);
|
||||||
@ -257,12 +260,12 @@ index 0000000000000000000000000000000000000000..d7945e7340f406fbf21a1bd67f9c167a
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private AsyncChatEvent createAsync(final ChatFormatter formatter, final Component message) {
|
+ private AsyncChatEvent createAsync(final ChatFormatter formatter, final Set<Player> recipients, final Component message) {
|
||||||
+ return new AsyncChatEvent(this.async, this.player.getBukkitEntity(), new LazyPlayerSet(this.server), formatter, message);
|
+ return new AsyncChatEvent(this.async, this.player.getBukkitEntity(), recipients, formatter, message);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private ChatEvent createSync(final ChatFormatter formatter, final Component message) {
|
+ private ChatEvent createSync(final ChatFormatter formatter, final Set<Player> recipients, final Component message) {
|
||||||
+ return new ChatEvent(this.player.getBukkitEntity(), new LazyPlayerSet(this.server), formatter, message);
|
+ return new ChatEvent(this.player.getBukkitEntity(), recipients, formatter, message);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @SuppressWarnings("deprecation")
|
+ @SuppressWarnings("deprecation")
|
||||||
|
@ -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 d7945e7340f406fbf21a1bd67f9c167a309d0fb7..63085b09eb4d7dc5ebbad9f3d8d6309990473b45 100644
|
index a8bc84d476093e6b39564450564f676adccde898..4934b732a602e0c9aba4957459490455b4b368b2 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
|
||||||
@@ -13,7 +13,9 @@ import net.kyori.adventure.text.event.ClickEvent;
|
@@ -14,7 +14,9 @@ import net.kyori.adventure.text.event.ClickEvent;
|
||||||
import net.minecraft.server.EntityPlayer;
|
import net.minecraft.server.EntityPlayer;
|
||||||
import net.minecraft.server.IChatBaseComponent;
|
import net.minecraft.server.IChatBaseComponent;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@ -39,7 +39,7 @@ index d7945e7340f406fbf21a1bd67f9c167a309d0fb7..63085b09eb4d7dc5ebbad9f3d8d63099
|
|||||||
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;
|
||||||
@@ -99,6 +101,9 @@ public final class ChatProcessor {
|
@@ -102,6 +104,9 @@ public final class ChatProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Component displayName(final CraftPlayer player) {
|
private static Component displayName(final CraftPlayer player) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren