SPIGOT-709: Extend the block place limit to arm swings

This commit is contained in:
Thinkofdeath 2015-03-15 22:09:27 +00:00 committed by Zach Brown
parent 77959421f4
commit 0969fa97c6
1 changed files with 22 additions and 2 deletions

View File

@ -1,11 +1,11 @@
From 60bb367ecd43ae6099214c05bca623be2088ff5e Mon Sep 17 00:00:00 2001 From bbc82ac5ec6cf152414fa0b8e7ccd080535cc993 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org> From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Sun, 29 Jun 2014 21:10:34 +0100 Date: Sun, 29 Jun 2014 21:10:34 +0100
Subject: [PATCH] Limit block placement/interaction packets 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 diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index ee6fa34..b4b3cbc 100644 index ee6fa34..d63c65d 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -626,10 +626,23 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList @@ -626,10 +626,23 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
@ -61,6 +61,26 @@ index ee6fa34..b4b3cbc 100644
} }
flag = true; flag = true;
@@ -1130,6 +1146,19 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
public void a(PacketPlayInArmAnimation packetplayinarmanimation) {
if (this.player.dead) return; // CraftBukkit
PlayerConnectionUtils.ensureMainThread(packetplayinarmanimation, this, this.player.u());
+ // Spigot start
+ boolean throttled = false;
+ if (lastPlace != -1 && packetplayinarmanimation.timestamp - lastPlace < 30 && packets++ >= 4) {
+ throttled = true;
+ } else if ( packetplayinarmanimation.timestamp - lastPlace >= 30 || lastPlace == -1 )
+ {
+ lastPlace = packetplayinarmanimation.timestamp;
+ packets = 0;
+ }
+ if (throttled) {
+ return;
+ }
+ // Spigot end
this.player.z();
// CraftBukkit start - Raytrace to look for 'rogue armswings'
float f1 = this.player.pitch;
-- --
2.1.0 2.1.0