Class Chest


  • public final class Chest
    extends WorldObject
    Represents a Chest.
    • Method Detail

      • isOpen

        public boolean isOpen()
        Checks if the Chest is open.
        Returns:
        True if another Survivor is using this Chest.
      • addItem

        public void addItem​(Item item)
        Overwrites the Item in the Chest with the provided Item.
        Parameters:
        item - The Item that will override the one in the Chest.
      • getItem

        public Item getItem()
        Gets the Item that is in this Chest. Can be null.
        Returns:
        The Item this Chest holds.
      • removeItem

        public Item removeItem()
        Removes and returns the Item in the Chest.
        Returns:
        The Item that is now no longer in the Chest.
      • getCanBeSearched

        public boolean getCanBeSearched()
        Checks if the Chest can be searched.
        Returns:
        True if an Item was not generated in this Chest yet.