diff --git a/CraftBukkit-Patches/0149-Limit-block-placement-interaction-packets.patch b/CraftBukkit-Patches/0149-Limit-block-placement-interaction-packets.patch index 11df3d67..d1ad91cd 100644 --- a/CraftBukkit-Patches/0149-Limit-block-placement-interaction-packets.patch +++ b/CraftBukkit-Patches/0149-Limit-block-placement-interaction-packets.patch @@ -1,33 +1,35 @@ -From f6eb9e31fca92d09625a8ed923e230669eace264 Mon Sep 17 00:00:00 2001 +From ae902e1db40476e4a91c80c47ba783816c03cc0d Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sun, 29 Jun 2014 21:10:34 +0100 Subject: [PATCH] Limit block placement/interaction packets diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index b723b73..9a7b256 100644 +index 9491101..20c49e3 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -573,7 +573,18 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -573,7 +573,20 @@ public class PlayerConnection implements PacketPlayInListener { } } + // Spigot start - limit place/interactions + private long lastPlace = -1; ++ private int packets = 0; + public void a(PacketPlayInBlockPlace packetplayinblockplace) { + boolean throttled = false; -+ if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 5) { ++ if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { + throttled = true; -+ } else ++ } else if ( packetplayinblockplace.timestamp - lastPlace >= 30 || lastPlace == -1 ) + { + lastPlace = packetplayinblockplace.timestamp; ++ packets = 0; + } + // Spigot end WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); // CraftBukkit start -@@ -616,10 +627,14 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -616,10 +629,14 @@ public class PlayerConnection implements PacketPlayInListener { // CraftBukkit start int itemstackAmount = itemstack.count; @@ -42,7 +44,7 @@ index b723b73..9a7b256 100644 // CraftBukkit - notch decrements the counter by 1 in the above method with food, // snowballs and so forth, but he does it in a place that doesn't cause the -@@ -640,7 +655,7 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -640,7 +657,7 @@ public class PlayerConnection implements PacketPlayInListener { return; }