Commits

Parker Hawke authored and md_5 committed e850144b070
#726: Add Inventory#isEmpty()
No tags

src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java

Modified
241 241 public int firstEmpty() {
242 242 ItemStack[] inventory = getStorageContents();
243 243 for (int i = 0; i < inventory.length; i++) {
244 244 if (inventory[i] == null) {
245 245 return i;
246 246 }
247 247 }
248 248 return -1;
249 249 }
250 250
251 + @Override
252 + public boolean isEmpty() {
253 + return inventory.isEmpty();
254 + }
255 +
251 256 public int firstPartial(Material material) {
252 257 Validate.notNull(material, "Material cannot be null");
253 258 material = CraftLegacy.fromLegacy(material);
254 259 ItemStack[] inventory = getStorageContents();
255 260 for (int i = 0; i < inventory.length; i++) {
256 261 ItemStack item = inventory[i];
257 262 if (item != null && item.getType() == material && item.getAmount() < item.getMaxStackSize()) {
258 263 return i;
259 264 }
260 265 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut