Class KeyDestroyingDoor

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

public class KeyDestroyingDoor extends LockedDoor
A KeyDestroyingDoor works just like a normal locked door, except that it destroys the key item when used. By using the requiredAmount parameter, it can also be programmed to consume more than one key item each time. Note that the item needn't be a real key; one could, for instance, also create a door that costs 5 pieces of gold to use. If you add such a door to the world, don't forget to add a sign or an NPC which tells the player how the door works.
Author:
daniel/kymara
  • Constructor Details

    • KeyDestroyingDoor

      public KeyDestroyingDoor(String key, String clazz)
      Creates a new KeyDestroying door which destroys 1 key when the player uses it.
      Parameters:
      key - The name of the item that is required to use the door
      clazz - The class. Responsible for how this door looks like.
    • KeyDestroyingDoor

      public KeyDestroyingDoor(String key, String clazz, int requiredAmount)
      Creates a new KeyDestroying 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 destroyed while passing through the door
  • Method Details

    • onUsed

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