From ecc5a3be980a621da4dd0cc099dfd1e3fc57f800 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 16 Jan 2011 16:39:05 +0100 Subject: [PATCH] Fixed removeItem implementation By: Erik Broes --- .../org/bukkit/craftbukkit/inventory/CraftInventory.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index fd24050a0f..8b7c06b16b 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/paper-server/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; } }