Class OwnedItem

All Implemented Interfaces:
EquipListener, TurnListener, UseListener, Killer, Cloneable, Iterable<String>, Serializable
Direct Known Subclasses:
Bestiary

public abstract class OwnedItem extends Item
Class representing an item owned by an entity.
  • Constructor Details

  • Method Details

    • describe

      public String describe()
      Description copied from class: Entity
      Describes the entity (if a players looks at it).
      Overrides:
      describe in class Item
      Returns:
      description from the players point of view
    • 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 Item
      Parameters:
      user - the RPEntity who uses the object
      Returns:
      true if successful
    • setOwner

      public abstract void setOwner(String name)
      Sets the owner of the item.
      Parameters:
      name - Owner's name.
    • getOwner

      public abstract String getOwner()
      Override to retrieve owner name.
      Returns:
      Name of owner or null if not owned.
    • hasOwner

      public boolean hasOwner()
      Override to check if item has owner.
      Returns:
      true if owned.
    • isOwner

      public boolean isOwner(String name)
      Checks if the submitted name matches the owner of the item.
      Parameters:
      name - Name to check.
      Returns:
      true if the name matches the item owner.
    • canEquipToSlot

      public boolean canEquipToSlot(RPEntity entity, String slot)
      Override to check if an entity can equip to slot.
      Parameters:
      entity - Entity attempting to equip.
      slot - Slot where item is being equipped.
      Returns:
      true if can be equipped, false otherwise.
    • onEquipFail

      public void onEquipFail(RPEntity entity, String slot)
      Override for action to take when an entity cannot equip to specified slot.
      Parameters:
      entity - Entity attempting to equip.
      slot - Slot where item could not be equipped.
    • onUseFail

      public void onUseFail(RPEntity user)
    • setBlacklistSlots

      public void setBlacklistSlots(List<String> slots)
      Sets the slots that this item cannot be equipped to if it has an owner.
      Parameters:
      slots - List of slot names.
    • setOwnerOnlySlots

      public void setOwnerOnlySlots(List<String> slots)
      Sets the slots that can be equipped to by owner only if it has an owner.
      Parameters:
      slots - List of slots names.