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

public abstract class Door extends AccessCheckingPortal implements TurnListener
A door is a special kind of portal which can be open or closed. 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.
  • Constructor Details

    • Door

      public Door(String clazz)
      Creates a new door.
      Parameters:
      clazz - The class. Responsible for how this door looks like.
    • Door

      public Door(String clazz, String rejectMessage)
      Creates a new door.
      Parameters:
      clazz - The class. Responsible for how this door looks like.
      rejectMessage - The message to given when rejected.
  • Method Details

    • generateRPClass

      public static void generateRPClass()
    • update

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

      public void open()
      Opens the door.
    • close

      protected void close()
      Closes the door.
    • isOpen

      protected boolean isOpen()
      Is the door open?
      Returns:
      true, if opened; false otherwise
    • onUsed

      public boolean onUsed(RPEntity user)
      Teleport (if the door is now open).
      Specified by:
      onUsed in interface UseListener
      Overrides:
      onUsed in class AccessCheckingPortal
      Parameters:
      user - that wants to pass.
      Returns:
      true if passed , false otherwise.
    • onUsedBackwards

      public void onUsedBackwards(RPEntity user, boolean hadPath)
      Description copied from class: Portal
      If this portal is the destination of another portal used.
      Overrides:
      onUsedBackwards in class Portal
      Parameters:
      user - the player who used the other portal teleporting to us
      hadPath - determines if entity was using mouse click to use portal
    • 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
    • onTurnReached

      public void onTurnReached(int currentTurn)
      Description copied from interface: TurnListener
      This method is called when the turn number is reached.
      Specified by:
      onTurnReached in interface TurnListener
      Parameters:
      currentTurn - current turn number