Skip to content

Commit

Permalink
Remove dead code (LegacyResult) (PaperMC#10411)
Browse files Browse the repository at this point in the history
* Stop firing AsyncPlayerChatPreviewEvent as chat preview was removed in 1.19.3. This is in parity with upstream

* formatting and small tweaks

* correctly set MESSAGE_CHANGED flag for modern modifications

---------

Co-authored-by: Jake Potrebic <[email protected]>
  • Loading branch information
brickmonster and Machine-Maker authored Apr 19, 2024
1 parent 862299b commit 9e886c4
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 316 deletions.
18 changes: 8 additions & 10 deletions patches/api/0006-Adventure.patch
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ index 0000000000000000000000000000000000000000..a0fd845bc9b2540c398fe1dbbf821803
+}
diff --git a/src/main/java/io/papermc/paper/event/player/AsyncChatCommandDecorateEvent.java b/src/main/java/io/papermc/paper/event/player/AsyncChatCommandDecorateEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..feece00981ebf932e64760e7a10a04ad080d0228
index 0000000000000000000000000000000000000000..01cf89d3558132912c4d0eb48c98cd8c06e46a67
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/AsyncChatCommandDecorateEvent.java
@@ -0,0 +1,28 @@
Expand All @@ -359,8 +359,8 @@ index 0000000000000000000000000000000000000000..feece00981ebf932e64760e7a10a04ad
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @ApiStatus.Internal
+ public AsyncChatCommandDecorateEvent(boolean async, @Nullable Player player, @NotNull Component originalMessage, @NotNull Component result) {
+ super(async, player, originalMessage, result);
+ public AsyncChatCommandDecorateEvent(@Nullable Player player, @NotNull Component originalMessage) {
+ super(player, originalMessage);
+ }
+
+ @Override
Expand All @@ -374,17 +374,16 @@ index 0000000000000000000000000000000000000000..feece00981ebf932e64760e7a10a04ad
+}
diff --git a/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java b/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..9e1eb774d841e2c7ffa8bef688d832bdffaa0944
index 0000000000000000000000000000000000000000..d4c01e4d332b46f0b129dd5f9e9737ba19923562
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java
@@ -0,0 +1,120 @@
@@ -0,0 +1,118 @@
+package io.papermc.paper.event.player;
+
+import net.kyori.adventure.text.Component;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.AsyncPlayerChatPreviewEvent;
+import org.bukkit.event.server.ServerEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
Expand Down Expand Up @@ -412,11 +411,11 @@ index 0000000000000000000000000000000000000000..9e1eb774d841e2c7ffa8bef688d832bd
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public AsyncChatDecorateEvent(final boolean async, final @Nullable Player player, final @NotNull Component originalMessage, final @NotNull Component result) {
+ super(async);
+ public AsyncChatDecorateEvent(final @Nullable Player player, final @NotNull Component originalMessage) {
+ super(true);
+ this.player = player;
+ this.originalMessage = originalMessage;
+ this.result = result;
+ this.result = originalMessage;
+ }
+
+ /**
Expand All @@ -443,7 +442,6 @@ index 0000000000000000000000000000000000000000..9e1eb774d841e2c7ffa8bef688d832bd
+ /**
+ * Gets the decoration result. This may already be different from
+ * {@link #originalMessage()} if some other listener to this event
+ * <b>OR</b> the legacy preview event ({@link AsyncPlayerChatPreviewEvent})
+ * changed the result.
+ *
+ * @return the result
Expand Down
Loading

0 comments on commit 9e886c4

Please sign in to comment.