Class PersonalChest

All Implemented Interfaces:
UseListener, Killer, Cloneable, Iterable<String>, Serializable

public class PersonalChest extends Chest
A PersonalChest is a Chest that can be used by everyone, but shows different contents depending on the player who is currently using it. Thus, a player can put in items into this chest and be sure that nobody else will be able to take them out.

Caution: each PersonalChest must be placed in such a way that only one player can stand next to it at a time, to prevent other players from stealing while the owner is looking at his items.

  • Field Details

  • Constructor Details

    • PersonalChest

      public PersonalChest()
      Create a personal chest using the default bank slot.
    • PersonalChest

      public PersonalChest(String bankName)
      Create a personal chest using a specific bank slot.
      Parameters:
      bankName - The name of the bank slot.
  • Method Details

    • getAttending

      public RPEntity getAttending()
      Gets the entitiy which is currently served by this chest.
      Returns:
      Entity
    • getBankSlot

      public RPSlot getBankSlot()
      Get the slot that holds items for this chest.
      Returns:
      A per-player/per-bank slot.
    • syncContent

      protected boolean syncContent()
      Sync the slot contents.
      Returns:
      true if it should be called again.
    • open

      public void open(RPEntity user)
      Open the chest for an attending user.
      Parameters:
      user - The attending user.
    • close

      public void close()
      Close the chest.
      Overrides:
      close in class Chest
    • open

      public void open()
      Don't let this be called directly for personal chests.
      Overrides:
      open in class Chest
    • onUsed

      public boolean onUsed(RPEntity user)
      Description copied from interface: UseListener
      Invoked when the object is used.
      Specified by:
      onUsed in interface UseListener
      Overrides:
      onUsed in class Chest
      Parameters:
      user - the RPEntity who uses the object
      Returns:
      true if successful
    • 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 Chest
      Parameters:
      definite - true for "the" and false for "a/an" in case the entity has no name
      Returns:
      name
    • onRemoved

      public void onRemoved(StendhalRPZone zone)
      Description copied from class: Entity
      Called when this object is being removed from a zone.
      Overrides:
      onRemoved in class Entity
      Parameters:
      zone - The zone this will be removed from.