From bf0015ebb3538aa22ecd711461222acc8dc0083f Mon Sep 17 00:00:00 2001 From: Parker Hawke Date: Sun, 16 Aug 2020 11:21:05 +1000 Subject: [PATCH] #540: Add Inventory#isEmpty() --- src/main/java/org/bukkit/inventory/Inventory.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java index 5a38d8f1..5576a6a8 100644 --- a/src/main/java/org/bukkit/inventory/Inventory.java +++ b/src/main/java/org/bukkit/inventory/Inventory.java @@ -288,6 +288,14 @@ public interface Inventory extends Iterable { */ public int firstEmpty(); + /** + * Check whether or not this inventory is empty. An inventory is considered + * to be empty if there are no ItemStacks in any slot of this inventory. + * + * @return true if empty, false otherwise + */ + public boolean isEmpty(); + /** * Removes all stacks in the inventory matching the given material. *