diff options
author | EvilSeph <evilseph@gmail.com> | 2011-08-08 23:01:33 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2011-08-12 21:20:44 -0400 |
commit | 27f7a995127287f97e7d85236a2f6bbfd465fbef (patch) | |
tree | 81a2dbbd4ed7b256c21a68a0c59a9facd066ed9a /src/main/java | |
parent | 96a0e87068a7c0a680d7b3577f1b7a8fec1204db (diff) | |
download | craftbukkit-27f7a995127287f97e7d85236a2f6bbfd465fbef.tar craftbukkit-27f7a995127287f97e7d85236a2f6bbfd465fbef.tar.gz craftbukkit-27f7a995127287f97e7d85236a2f6bbfd465fbef.tar.lz craftbukkit-27f7a995127287f97e7d85236a2f6bbfd465fbef.tar.xz craftbukkit-27f7a995127287f97e7d85236a2f6bbfd465fbef.zip |
Item drop handling changes.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 6a454895..a2a0e0f6 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -61,6 +61,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } private final CraftServer server; private int lastTick = MinecraftServer.currentTick; + private int lastDropTick = MinecraftServer.currentTick; + private int dropCount = 0; private static final int PLACE_DISTANCE_SQUARED = 6 * 6; // Get position of last block hit for BlockDamageLevel.STOPPED @@ -423,6 +425,20 @@ public class NetServerHandler extends NetHandler implements ICommandListener { WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); if (packet14blockdig.e == 4) { + // CraftBukkit start + // If the ticks aren't the same then the count starts from 0 and we update the lastDropTick. + if (this.lastDropTick != MinecraftServer.currentTick) { + this.dropCount = 0; + this.lastDropTick = MinecraftServer.currentTick; + } else { + // Else we increment the drop count and check the amount. + this.dropCount++; + if (this.dropCount >= 20) { + a.warning(this.player.name + " dropped their items too quickly!"); + this.disconnect("You dropped your items too quickly (Hacking?)"); + } + } + // CraftBukkit end this.player.F(); } else { boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name); // CraftBukkit |