Class EntityLandEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
io.papermc.paper.event.entity.EntityLandEvent
- All Implemented Interfaces:
Cancellable
Called when an
Entity lands on the block after falling.
This event is called before EntityDamageEvent, EntityChangeBlockEvent, PlayerInteractEvent
and EntityInteractEvent.-
Nested Class Summary
Nested classes/interfaces inherited from class Event
Event.Result -
Field Summary
Fields inherited from class EntityEvent
entity -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBlock()Returns the block that the entity landed on.doubleGets the fall distance of the entity before landing.static HandlerListbooleanGets the cancellation state of this event.voidsetCancelled(boolean cancel) Sets whether to cancel the landing, cancelling this event will prevent the entity from taking fall damage and interact with the block.voidsetFallDistance(@NonNegative double fallDistance) Sets the fall distance of the entity before landing.Methods inherited from class EntityEvent
getEntity, getEntityTypeMethods inherited from class Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
EntityLandEvent
-
-
Method Details
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-
getBlock
Returns the block that the entity landed on.- Returns:
- the block that the entity landed on
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
isCancelledin interfaceCancellable- Returns:
trueif this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel) Sets whether to cancel the landing, cancelling this event will prevent the entity from taking fall damage and interact with the block. (ex: break turtle egg)- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel- true if the event should be cancelled, false otherwise
-
getFallDistance
public double getFallDistance()Gets the fall distance of the entity before landing.- Returns:
- the fall distance
-
setFallDistance
public void setFallDistance(@NonNegative double fallDistance) Sets the fall distance of the entity before landing. Fall distance in the event is used to calculate fall damage and the chance of transformingMaterial.FARMLANDtoMaterial.DIRTand the type of falling sound when the entity lands onMaterial.POWDER_SNOW.- Parameters:
fallDistance- the fall distance- Throws:
IllegalArgumentException- if the fall distance is negative or not finite
-