From ebfd973d09a87b8f7cc6314935e876d864d1eab6 Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Thu, 23 Jun 2011 01:08:56 -0400 Subject: [PATCH] Fixed PlayerPickupItem event firing even if the player could not pick up the item. --- src/main/java/net/minecraft/server/EntityItem.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index f7b55c7c55..529dd3270b 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -127,12 +127,12 @@ public class EntityItem extends Entity { int i = this.itemStack.count; // CraftBukkit start - if (this.pickupDelay <= 0) { // <-- == to <= + if (this.pickupDelay <= 0 && entityhuman.inventory.canHold(this.itemStack)) { // <-- == to <= Player player = (Player) entityhuman.getBukkitEntity(); PlayerPickupItemEvent event = new PlayerPickupItemEvent(player, (org.bukkit.entity.Item) this.getBukkitEntity()); - ((WorldServer) world).getServer().getPluginManager().callEvent(event); + world.getServer().getPluginManager().callEvent(event); - if (event.isCancelled() || !entityhuman.inventory.canHold(this.itemStack)) { + if (event.isCancelled()) { return; } // CraftBukkit end