Class Inventory
java.lang.Object
com.csse3200.game.progression.inventory.Inventory
Inventory class to manage the player's items.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an item to the inventory.boolean
Checks if the inventory contains the specified item key.boolean
containsMoreThanOne
(String itemKey) Checks if the inventory contains multiple of the specified item key.Get the items in the inventory.getKeys()
Gets the list of items in the inventory.void
removeItem
(String itemKey) Removes an item from the inventory.
-
Constructor Details
-
Inventory
public Inventory()Constructor for the Inventory class.
-
-
Method Details
-
addItem
Adds an item to the inventory.- Parameters:
itemKey
- The key of the item to add.
-
removeItem
Removes an item from the inventory.- Parameters:
itemKey
- The key of the item to remove.
-
getKeys
Gets the list of items in the inventory.- Returns:
- The list of keys of the items in the inventory.
-
contains
Checks if the inventory contains the specified item key.- Parameters:
itemKey
- The key of the item to check.- Returns:
- True if the inventory contains the item key, false otherwise.
-
containsMoreThanOne
Checks if the inventory contains multiple of the specified item key.- Parameters:
itemKey
- The key of the item to check.- Returns:
- True if the inventory contains more than one of the item, false otherwise.
-
getInventoryItems
Get the items in the inventory.- Returns:
- the items in the inventory.
-