summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2022-07-28 01:59:19 +0200
committerNassim Jahnke <[email protected]>2022-07-28 01:59:19 +0200
commitc488d15359ff4817cedada24a96f884be8124da5 (patch)
treef7b657ac697e05f41961b155b0b2d0bbf6114115
parent2184cd22524b5e43601527298f6ab8d65c44b79d (diff)
downloadPaper-c488d15359ff4817cedada24a96f884be8124da5.tar.gz
Paper-c488d15359ff4817cedada24a96f884be8124da5.zip
Don't fire preview event for non-player senders
Fixes #8195
-rw-r--r--patches/server/0924-Dont-fire-preview-event-for-console.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/patches/server/0924-Dont-fire-preview-event-for-console.patch b/patches/server/0924-Dont-fire-preview-event-for-console.patch
new file mode 100644
index 0000000000..a693965b23
--- /dev/null
+++ b/patches/server/0924-Dont-fire-preview-event-for-console.patch
@@ -0,0 +1,22 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Nassim Jahnke <[email protected]>
+Date: Thu, 28 Jul 2022 01:57:24 +0200
+Subject: [PATCH] Dont fire preview event for console
+
+
+diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
+index 6a81076239080ae6457308ca2e3628c3d32691bf..e7d1ccffd4b783518a7b200d440f6f12f2ed0c86 100644
+--- a/src/main/java/net/minecraft/server/MinecraftServer.java
++++ b/src/main/java/net/minecraft/server/MinecraftServer.java
+@@ -2600,6 +2600,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
+
+ public ChatDecorator getChatDecorator() {
+ return (entityplayer, ichatbasecomponent) -> {
++ // Paper start - fix non-player sender
++ if (entityplayer == null) {
++ return CompletableFuture.completedFuture(ichatbasecomponent);
++ }
++ // Paper end
+ return CompletableFuture.supplyAsync(() -> {
+ AsyncPlayerChatPreviewEvent event = new AsyncPlayerChatPreviewEvent(true, entityplayer.getBukkitEntity(), CraftChatMessage.fromComponent(ichatbasecomponent), new LazyPlayerSet(this));
+ String originalFormat = event.getFormat(), originalMessage = event.getMessage();