summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorNathan Adams <dinnerbone@dinnerbone.com>2012-01-14 13:27:15 +0000
committerNathan Adams <dinnerbone@dinnerbone.com>2012-01-14 13:27:15 +0000
commit3d31c27864f4be0ccc78ea0f0dfa26f9ea2e3e82 (patch)
treec2f7181466e30303078e94f018c4e49bb751af27 /src/main/java
parentd5438c30b9fbf00d95a37ce8112732b98e738dca (diff)
downloadcraftbukkit-3d31c27864f4be0ccc78ea0f0dfa26f9ea2e3e82.tar
craftbukkit-3d31c27864f4be0ccc78ea0f0dfa26f9ea2e3e82.tar.gz
craftbukkit-3d31c27864f4be0ccc78ea0f0dfa26f9ea2e3e82.tar.lz
craftbukkit-3d31c27864f4be0ccc78ea0f0dfa26f9ea2e3e82.tar.xz
craftbukkit-3d31c27864f4be0ccc78ea0f0dfa26f9ea2e3e82.zip
Fixed players attempting to attack item entities - This fixes BUKKIT-341
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index 0e242615..ecdad7da 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -922,10 +922,15 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (itemInHand != null && itemInHand.count <= -1) {
this.player.updateInventory(this.player.activeContainer);
}
- // CraftBukkit end
} else if (packet7useentity.c == 1) {
+ if (entity instanceof EntityItem) {
+ disconnect("Attacking an item is not permitted");
+ System.out.println("Player " + player.name + " tried to attack an item entity, so I have disconnected them for exploiting.");
+ return;
+ }
+
this.player.f(entity);
- // CraftBukkit start - update the client if the item is an infinite one
+
if (itemInHand != null && itemInHand.count <= -1) {
this.player.updateInventory(this.player.activeContainer);
}