Class SuddenDeathDragonTargetEvent

java.lang.Object
org.bukkit.event.Event
me.metallicgoat.tweaksaddon.api.events.gentiers.SuddenDeathDragonTargetEvent
All Implemented Interfaces:
ArenaEvent, Cancellable

public class SuddenDeathDragonTargetEvent extends Event implements ArenaEvent, Cancellable
Gets called when a sudden death dragon needs to find a target to fly to.

Either called right with the dragon's spawning, or once it reaches the prior target.

  • Constructor Details

  • Method Details

    • getDragon

      public SuddenDeathDragon getDragon()
      Get the dragon entity that is targeting something.
      Returns:
      The dragon involved in this event
    • getTargetEntity

      @Nullable public @Nullable Entity getTargetEntity()
      Get the specifically targeted entity.
      Returns:
      The targeted entity. May be null if it's targeting a location instead
    • hasTargetEntity

      public boolean hasTargetEntity()
      Get whether the dragon is targeting an entity specifically.
      Returns:
      If an entity is specifically targeted
    • setTargetEntity

      public void setTargetEntity(@Nullable @Nullable Entity targetEntity)
      Change the entity which the dragon is targeting.

      NOTE: The entity must be in the same world as the dragon. Passing null makes the dragon fly to getTargetLocation() instead.

      Also changes the target-location to Entity.getLocation(), if it's non-null.

      Parameters:
      targetEntity - to target
      Throws:
      IllegalArgumentException - If Entity.isValid() returns false
      IllegalArgumentException - If the entity's world differs to the dragon's world
    • getTargetLocation

      public Location getTargetLocation()
      Get the (mutable) location the dragon shall fly to.
      Returns:
      The current target location
    • setTargetLocation

      public void setTargetLocation(Location targetLocation)
      Change the location which the dragon is targeting.

      NOTE: The location must be in the same world as the dragon. It also purges the current target-entity state, meaning hasTargetEntity() will return false after this method is called.

      Parameters:
      targetLocation - to target
      Throws:
      IllegalArgumentException - If the location's world differs to the dragon's world
    • getPreviousTargetEntity

      @Nullable public @Nullable Entity getPreviousTargetEntity()
      Get the previous entity that has been targeted by this dragon.
      Returns:
      The entity target prior this event. May be null if there hasn't been any
    • getPreviousTargetLocation

      @Nullable public @Nullable Location getPreviousTargetLocation()
      Get the previous location that has been targeted by this dragon.
      Returns:
      The entity target prior this event. May be null if there hasn't been any
    • hasPreviousTargetEntity

      public boolean hasPreviousTargetEntity()
      Get whether an entity has ever been before targeted by this dragon.
      Returns:
      true if there has been one
    • hasPreviousTargetLocation

      public boolean hasPreviousTargetLocation()
      Get whether a location has ever been before targeted by this dragon.
      Returns:
      true if there has been one
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()