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

public class LockedDoor extends Door
A locked door is a special kind of portal which requires a key to pass it. If the player carries the key with him, he can use the door just like a normal portal; it will automatically open and close. By using the requiredAmount parameter, it can need more than one item for a key Note that you can link a door with a portal; that way, people only require the key when walking in one direction and can walk in the other direction without any key.
  • Field Details

    • requiredAmount

      protected int requiredAmount
  • Constructor Details

    • LockedDoor

      public LockedDoor(String key, String clazz)
      Creates a new Locked door which need 1 key item.
      Parameters:
      key - The name of the item that is required to use the door
      clazz - The class. Responsible for how this door looks like.
    • LockedDoor

      public LockedDoor(String key, String clazz, int requiredAmount)
      Creates a new Locked door.
      Parameters:
      key - The name of the item that is required to use the door
      clazz - The class. Responsible for how this door looks like.
      requiredAmount - The number of key items that are needed
  • Method Details

    • isAllowed

      protected boolean isAllowed(RPEntity user)
      Description copied from class: AccessCheckingPortal
      Determine if this portal can be used.
      Specified by:
      isAllowed in class AccessCheckingPortal
      Parameters:
      user - The user to be checked.
      Returns:
      true if the user can use the portal.