Ok so I'm working on making a simple text-based game, and I've got two methods - one that removes an item from the player's inventory, and another that works with breaking said item. The issue comes in in that any object of class Items can be removed from inventory via the method removeFromInventory. The method breakItem only works for CombatItems, however, which are a subclass of Items. Only they can break, as only they have durability. Im not sure what it is that I can do, but heres the code from both methods, if its any help in figuring out what to do.
public void removeFromInventory(Items I) { if(Inventory.size() >= 0 && Inventory.indexOf(c) >= 0) { Inventory.remove(I); } else { System.out.println("That item isn't located in your inventory."); } } public void breakItem(CombatItem c) { if(c.getCurDurability() <= 0) { removeFromInventory(c); } }