From 0e4358fb7e24d9bcd61176d75524cede07307f35 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Tue, 7 Mar 2023 13:22:53 -0800 Subject: [PATCH] Make Player#kickPlayer function asynchronously We have made disconnect() mt-safe, so there is no need for this check anymore. --- patches/server/0004-Threaded-Regions.patch | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/patches/server/0004-Threaded-Regions.patch b/patches/server/0004-Threaded-Regions.patch index 782ff31..3bb9154 100644 --- a/patches/server/0004-Threaded-Regions.patch +++ b/patches/server/0004-Threaded-Regions.patch @@ -22155,9 +22155,18 @@ index 78f53ee557276de85f0431ebcb146445b1f4fb92..91a11cfa430c63455e2d54125d6e1bd4 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 0351eb67bac6ce257f820af60aa3bba9f45da687..88006751825515966dcea1f779ac5452c8ddd964 100644 +index 0351eb67bac6ce257f820af60aa3bba9f45da687..7b29843302d7aba8e64a2533a4b2203e9f30ecca 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -563,7 +563,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + + @Override + public void kickPlayer(String message) { +- org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot ++ //org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot // Folia - thread-safe now, as it will simply delay the kick + if (this.getHandle().connection == null) return; + + this.getHandle().connection.disconnect(message == null ? "" : message, org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN); // Paper - kick event cause @@ -1702,7 +1702,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { private void unregisterEntity(Entity other) { // Paper end