/** * Checks how many of the specified item the bank contains. * * @param itemID ID of the item to count. * @return itemAmount Stack size of item in bank. */ public int getCount(int itemID) { if (!isOpen()) return 0; for (Item item : getItems()) { if (item == null) continue; if (item.getID() == itemID) return item.getStackSize(); } return 0; }
/** * Checks how many of the specified item the bank contains. * * @param itemName Case-insensitive item name to count. * @return itemAmount Stack size of item in bank. */ public int getCount(String itemName) { if (!isOpen()) return 0; for (Item item : getItems()) { if (item == null) continue; else if (item.getName().equalsIgnoreCase(itemName)) return item.getStackSize(); } return 0; }