Class Inventory

java.lang.Object
com.csse3200.game.progression.inventory.Inventory

public class Inventory extends Object
Inventory class to manage the player's items.
  • Constructor Details

    • Inventory

      public Inventory()
      Constructor for the Inventory class.
  • Method Details

    • addItem

      public void addItem(String itemKey)
      Adds an item to the inventory.
      Parameters:
      itemKey - The key of the item to add.
    • removeItem

      public void removeItem(String itemKey)
      Removes an item from the inventory.
      Parameters:
      itemKey - The key of the item to remove.
    • getKeys

      public List<String> getKeys()
      Gets the list of items in the inventory.
      Returns:
      The list of keys of the items in the inventory.
    • contains

      public boolean contains(String itemKey)
      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

      public boolean containsMoreThanOne(String itemKey)
      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

      public Map<String,BaseItemConfig> getInventoryItems()
      Get the items in the inventory.
      Returns:
      the items in the inventory.