/** * Checks if the player has a certain amount (or more) of a specified item * * @param item - Specified item * @param amount - Amount to check for * @return boolean */ public boolean hasItem(Item item, int amount) { if (item.getStack() >= amount) { return true; } else { return false; } }
/** * Removes the amount of items to its stack * * @param item - Item to control * @param amount - Amount to decrease by */ public void removeItem(Item item, int amount) { item.setStack(item.getStack() - amount); Sys.print(amount + " " + item.getName() + " was removed from your inventory!"); }
/** * Adds the amount of items to its stack * * @param item - Item to control * @param amount - Amount to increase by */ public void addItem(Item item, int amount) { item.setStack(item.getStack() + amount); Sys.print(amount + " " + item.getName() + " was added to your inventory!"); }