All Implemented Interfaces:
UseListener, Killer, Cloneable, Iterable<String>, Serializable
Direct Known Subclasses:
NPCOwnedChest, PersonalChest, StoredChest

public class Chest extends Entity implements UseListener
A chest is an unmovable container. It can be opened and closed. While it is open, every player can put items in and take them out later. A player can take out items that another player put in.
  • Constructor Details

    • Chest

      public Chest()
      Creates a new chest.
    • Chest

      public Chest(RPObject object)
      Creates a new chest.
      Parameters:
      object - RPObject
  • Method Details

    • generateRPClass

      public static void generateRPClass()
    • getDescriptionName

      public String getDescriptionName(boolean definite)
      Description copied from class: Entity
      Returns the name or something that can be used to identify the entity for the player.
      Overrides:
      getDescriptionName in class Entity
      Parameters:
      definite - true for "the" and false for "a/an" in case the entity has no name
      Returns:
      name
    • update

      public void update()
      Overrides:
      update in class Entity
    • open

      public void open()
      Open the chest.
    • close

      public void close()
      Close the chest.
    • isOpen

      public boolean isOpen()
      Determine if the chest is open.
      Returns:
      true if the chest is open.
    • add

      public void add(PassiveEntity entity)
      Adds a passive entity (like an item) to the chest.
      Parameters:
      entity - entity to add
    • size

      public int size()
      Description copied from class: RPObject
      Returns the number of attributes and events this object is made of.
      Overrides:
      size in class RPObject
      Returns:
      amount of attributes
    • getContent

      public Iterator<RPObject> getContent()
      Returns the content.
      Returns:
      iterator for the content
    • onUsed

      public boolean onUsed(RPEntity user)
      Description copied from interface: UseListener
      Invoked when the object is used.
      Specified by:
      onUsed in interface UseListener
      Parameters:
      user - the RPEntity who uses the object
      Returns:
      true if successful
    • describe

      public String describe()
      Description copied from class: Entity
      Describes the entity (if a players looks at it).
      Overrides:
      describe in class Entity
      Returns:
      description from the players point of view