From e2480e1347e6d6dc3e9b906289f3cd9641b089b7 Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Thu, 7 Apr 2011 13:06:55 -0400 Subject: [PATCH] Fixed firstEmpty() by making it search for the first null instead of Material.AIR. --- .../org/bukkit/craftbukkit/inventory/CraftInventory.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index 36ecb11a1f..1f5f9a0968 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -173,7 +173,13 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { } public int firstEmpty() { - return first(Material.AIR); + ItemStack[] inventory = getContents(); + for (int i = 0; i < inventory.length; i++) { + if (inventory[i] == null) { + return i; + } + } + return -1; } public int firstPartial(int materialId) {