Class SuddenDeathDragonTargetEvent
java.lang.Object
org.bukkit.event.Event
me.metallicgoat.tweaksaddon.api.events.gentiers.SuddenDeathDragonTargetEvent
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionSuddenDeathDragonTargetEvent(Arena arena, SuddenDeathDragon dragon, @Nullable Entity targetEntity, Location targetLocation, Location previousTargetLocation, Entity previousTargetEntity) -
Method Summary
Modifier and TypeMethodDescriptionGet the dragon entity that is targeting something.static HandlerList@Nullable EntityGet the previous entity that has been targeted by this dragon.@Nullable LocationGet the previous location that has been targeted by this dragon.@Nullable EntityGet the specifically targeted entity.Get the (mutable) location the dragon shall fly to.booleanGet whether an entity has ever been before targeted by this dragon.booleanGet whether a location has ever been before targeted by this dragon.booleanGet whether the dragon is targeting an entity specifically.voidsetTargetEntity(@Nullable Entity targetEntity) Change the entity which the dragon is targeting.voidsetTargetLocation(Location targetLocation) Change the location which the dragon is targeting.Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronousMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.marcely.bedwars.api.event.arena.ArenaEvent
getArenaMethods inherited from interface org.bukkit.event.Cancellable
isCancelled, setCancelled
-
Constructor Details
-
SuddenDeathDragonTargetEvent
-
-
Method Details
-
getDragon
Get the dragon entity that is targeting something.- Returns:
- The dragon involved in this event
-
getTargetEntity
Get the specifically targeted entity.- Returns:
- The targeted entity. May be
nullif 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
Change the entity which the dragon is targeting.NOTE: The entity must be in the same world as the dragon. Passing
nullmakes the dragon fly togetTargetLocation()instead.Also changes the target-location to
Entity.getLocation(), if it's non-null.- Parameters:
targetEntity- to target- Throws:
IllegalArgumentException- IfEntity.isValid()returns falseIllegalArgumentException- If the entity's world differs to the dragon's world
-
getTargetLocation
Get the (mutable) location the dragon shall fly to.- Returns:
- The current target location
-
setTargetLocation
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 returnfalseafter this method is called.- Parameters:
targetLocation- to target- Throws:
IllegalArgumentException- If the location's world differs to the dragon's world
-
getPreviousTargetEntity
Get the previous entity that has been targeted by this dragon.- Returns:
- The entity target prior this event. May be
nullif there hasn't been any
-
getPreviousTargetLocation
Get the previous location that has been targeted by this dragon.- Returns:
- The entity target prior this event. May be
nullif there hasn't been any
-
hasPreviousTargetEntity
public boolean hasPreviousTargetEntity()Get whether an entity has ever been before targeted by this dragon.- Returns:
trueif there has been one
-
hasPreviousTargetLocation
public boolean hasPreviousTargetLocation()Get whether a location has ever been before targeted by this dragon.- Returns:
trueif there has been one
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-