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

public class KeyedPortal extends AccessCheckingPortal
A keyed portal 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 portal just like a normal portal.
  • Field Details

    • key

      protected String key
      The key item needed.
    • quantity

      protected int quantity
      The minimum number of items.
  • Constructor Details

    • KeyedPortal

      public KeyedPortal(String key)
      Creates a new keyed portal.
      Parameters:
      key - The name of the required key.
    • KeyedPortal

      public KeyedPortal(String key, int quantity)
      Creates a new keyed portal.
      Parameters:
      key - The name of the required key.
      quantity - The key quantity required.
    • KeyedPortal

      public KeyedPortal(String key, int quantity, String rejectMessage)
      Creates a new keyed portal.
      Parameters:
      key - The name of the required key.
      quantity - The key quantity required.
      rejectMessage - The message given when rejected.
  • Method Details

    • isAllowed

      protected boolean isAllowed(RPEntity user)
      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.