From 642328f521a95b14e0792d5519ed3e12a715ff8d Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 18 Jan 2022 08:16:36 +0100 Subject: [PATCH] Push illegal char kick to main thread (#7363) --- .../Kick-on-main-for-illegal-chars.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/server/Kick-on-main-for-illegal-chars.patch diff --git a/patches/server/Kick-on-main-for-illegal-chars.patch b/patches/server/Kick-on-main-for-illegal-chars.patch new file mode 100644 index 0000000000..7a8057f332 --- /dev/null +++ b/patches/server/Kick-on-main-for-illegal-chars.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Mon, 17 Jan 2022 19:47:19 +0100 +Subject: [PATCH] Kick on main for illegal chars + + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + + for (int i = 0; i < s.length(); ++i) { + if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { ++ this.server.scheduleOnMain(() -> { // Paper - push to main for event firing + this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause ++ }); // Paper - push to main for event firing + return; + } + }