Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 19:10:09 +01:00
Fix legacyComposer not using AsyncChatEvent messages (#5509)
Dieser Commit ist enthalten in:
Ursprung
053bd82cc2
Commit
d94882043d
@ -105,7 +105,7 @@ 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..84dcca67ccd2e52881b4a97de0f061b396ab5f35
|
index 0000000000000000000000000000000000000000..50253e8dfffc84e26f02c6a470a5a8b078d90e12
|
||||||
--- /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,215 @@
|
@@ -0,0 +1,215 @@
|
||||||
@ -165,13 +165,13 @@ index 0000000000000000000000000000000000000000..84dcca67ccd2e52881b4a97de0f061b3
|
|||||||
+ this.async = async;
|
+ this.async = async;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @SuppressWarnings("CodeBlock2Expr")
|
+ @SuppressWarnings({"CodeBlock2Expr", "deprecated"})
|
||||||
+ public void process() {
|
+ public void process() {
|
||||||
+ this.processingLegacyFirst(
|
+ this.processingLegacyFirst(
|
||||||
+ // continuing from AsyncPlayerChatEvent (without PlayerChatEvent)
|
+ // continuing from AsyncPlayerChatEvent (without PlayerChatEvent)
|
||||||
+ event -> {
|
+ event -> {
|
||||||
+ this.processModern(
|
+ this.processModern(
|
||||||
+ legacyComposer(event.getFormat(), legacyDisplayName((CraftPlayer) event.getPlayer()), event.getMessage()),
|
+ legacyComposer(event.getFormat()),
|
||||||
+ event.getRecipients(),
|
+ event.getRecipients(),
|
||||||
+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage()),
|
+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage()),
|
||||||
+ event.isCancelled()
|
+ event.isCancelled()
|
||||||
@ -180,7 +180,7 @@ index 0000000000000000000000000000000000000000..84dcca67ccd2e52881b4a97de0f061b3
|
|||||||
+ // continuing from AsyncPlayerChatEvent and PlayerChatEvent
|
+ // continuing from AsyncPlayerChatEvent and PlayerChatEvent
|
||||||
+ event -> {
|
+ event -> {
|
||||||
+ this.processModern(
|
+ this.processModern(
|
||||||
+ legacyComposer(event.getFormat(), legacyDisplayName((CraftPlayer) event.getPlayer()), event.getMessage()),
|
+ legacyComposer(event.getFormat()),
|
||||||
+ event.getRecipients(),
|
+ event.getRecipients(),
|
||||||
+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage()),
|
+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage()),
|
||||||
+ event.isCancelled()
|
+ event.isCancelled()
|
||||||
@ -297,8 +297,8 @@ index 0000000000000000000000000000000000000000..84dcca67ccd2e52881b4a97de0f061b3
|
|||||||
+ return player.displayName();
|
+ return player.displayName();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private static ChatComposer legacyComposer(final String format, final String legacyDisplayName, final String legacyMessage) {
|
+ private static ChatComposer legacyComposer(final String format) {
|
||||||
+ return (player, displayName, message) -> PaperAdventure.LEGACY_SECTION_UXRC.deserialize(String.format(format, legacyDisplayName, legacyMessage)).replaceText(URL_REPLACEMENT_CONFIG);
|
+ return (player, displayName, message) -> PaperAdventure.LEGACY_SECTION_UXRC.deserialize(String.format(format, legacyDisplayName((CraftPlayer) player), PaperAdventure.LEGACY_SECTION_UXRC.serialize(message))).replaceText(URL_REPLACEMENT_CONFIG);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private void queueIfAsyncOrRunImmediately(final Waitable<Void> waitable) {
|
+ private void queueIfAsyncOrRunImmediately(final Waitable<Void> waitable) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren