Merge pull request #328 from slipcor/empty-inventory
Always check for both null stacks and "air stacks" (ItemStack ID 0) when checking for empty inventories. Fixes #302
This commit is contained in:
@@ -108,15 +108,14 @@ public class InventoryManager
|
|||||||
ItemStack[] inventory = p.getInventory().getContents();
|
ItemStack[] inventory = p.getInventory().getContents();
|
||||||
ItemStack[] armor = p.getInventory().getArmorContents();
|
ItemStack[] armor = p.getInventory().getArmorContents();
|
||||||
|
|
||||||
// For inventory, check for null
|
// Check for null or id 0, or AIR
|
||||||
for (ItemStack stack : inventory) {
|
for (ItemStack stack : inventory) {
|
||||||
if (stack != null)
|
if (stack != null && stack.getTypeId() != 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For armor, check for id 0, or AIR
|
|
||||||
for (ItemStack stack : armor) {
|
for (ItemStack stack : armor) {
|
||||||
if (stack.getTypeId() != 0)
|
if (stack != null && stack.getTypeId() != 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user