From 885ae9871eef885cb688ccc268edc46744d59b60 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Fri, 3 Jan 2014 17:32:20 +0000 Subject: [PATCH] Disconnect for spam in the main thread --- ....patch => 0086-Add-Late-Bind-Option.patch} | 4 +- ...sconnect-for-spam-in-the-main-thread.patch | 42 +++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) rename CraftBukkit-Patches/{0087-Add-Late-Bind-Option.patch => 0086-Add-Late-Bind-Option.patch} (97%) create mode 100644 CraftBukkit-Patches/0087-Disconnect-for-spam-in-the-main-thread.patch diff --git a/CraftBukkit-Patches/0087-Add-Late-Bind-Option.patch b/CraftBukkit-Patches/0086-Add-Late-Bind-Option.patch similarity index 97% rename from CraftBukkit-Patches/0087-Add-Late-Bind-Option.patch rename to CraftBukkit-Patches/0086-Add-Late-Bind-Option.patch index 58adba4e4..e9599e2b0 100644 --- a/CraftBukkit-Patches/0087-Add-Late-Bind-Option.patch +++ b/CraftBukkit-Patches/0086-Add-Late-Bind-Option.patch @@ -1,4 +1,4 @@ -From 8be2e6bb5953a4b90a6226546775e9746a65516e Mon Sep 17 00:00:00 2001 +From 851a08e3828b82aa5833285611af33e71141a82d Mon Sep 17 00:00:00 2001 From: slide23 Date: Fri, 20 Dec 2013 20:15:33 -0600 Subject: [PATCH] Add Late Bind Option @@ -70,5 +70,5 @@ index 628533e..cb5002f + } } -- -1.8.3.2 +1.8.4.msysgit.0 diff --git a/CraftBukkit-Patches/0087-Disconnect-for-spam-in-the-main-thread.patch b/CraftBukkit-Patches/0087-Disconnect-for-spam-in-the-main-thread.patch new file mode 100644 index 000000000..5fad41a9c --- /dev/null +++ b/CraftBukkit-Patches/0087-Disconnect-for-spam-in-the-main-thread.patch @@ -0,0 +1,42 @@ +From b8eba900197cdc6e9c71feff78e051292b3de6e5 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Fri, 3 Jan 2014 17:30:52 +0000 +Subject: [PATCH] Disconnect for spam in the main thread + + +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 1903362..f7fdca3 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -838,7 +838,27 @@ public class PlayerConnection implements PacketPlayInListener { + // this.chatThrottle += 20; + if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { + // CraftBukkit end +- this.disconnect("disconnect.spam"); ++ if (packetplayinchat.a()) { // Spigot - Thread safety ++ Waitable waitable = new Waitable() { ++ @Override ++ protected Object evaluate() { ++ PlayerConnection.this.disconnect( "disconnect.spam" ); ++ return null; ++ } ++ }; ++ ++ this.minecraftServer.processQueue.add(waitable); ++ ++ try { ++ waitable.get(); ++ } catch (InterruptedException e) { ++ Thread.currentThread().interrupt(); ++ } catch (ExecutionException e) { ++ throw new RuntimeException(e); ++ } ++ } else { ++ PlayerConnection.this.disconnect( "disconnect.spam" ); ++ } + } + } + } +-- +1.8.4.msysgit.0 +