From d048167d16a404f1f0616d3b62797fce17311198 Mon Sep 17 00:00:00 2001 From: Erik Broes Date: Sun, 16 Jan 2011 16:39:05 +0100 Subject: Fixed removeItem implementation --- src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main/java/org/bukkit') diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index fd24050a..8b7c06b1 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -234,18 +234,19 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { if (first == -1) { item.setAmount( toDelete ); leftover.put(i, item); + break; } else { - ItemStack itemStack = getItem(first); + CraftItemStack itemStack = getItem(first); int amount = itemStack.getAmount(); if (amount <= toDelete) { toDelete -= amount; // clear the slot, all used up - clear( i ); + clear( first ); } else { // split the stack and store itemStack.setAmount( amount - toDelete ); - setItem( i, itemStack ); + setItem( first, itemStack ); toDelete = 0; } } -- cgit v1.2.3