Package org.bukkit.event.entity
Class EntityKnockbackEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
org.bukkit.event.entity.EntityKnockbackEvent
- All Implemented Interfaces:
- Cancellable
- Direct Known Subclasses:
- EntityKnockbackByEntityEvent
Called when a living entity receives knockback.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumAn enum to specify the cause of the knockback.Nested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Field SummaryFields inherited from class org.bukkit.event.entity.EntityEvententity
- 
Constructor SummaryConstructorsConstructorDescriptionEntityKnockbackEvent(LivingEntity entity, EntityKnockbackEvent.KnockbackCause cause, double force, Vector rawKnockback, Vector knockback) 
- 
Method SummaryModifier and TypeMethodDescriptiongetCause()Gets the cause of the knockback.Returns the Entity involved in this eventGets the force that will be applied to the entity.doublegetForce()Gets the raw force of the knockback.static HandlerListGets the raw knockback force that will be applied to the entity.booleanGets the cancellation state of this event.voidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidsetFinalKnockback(Vector knockback) Sets the force that will be applied to the entity.Methods inherited from class org.bukkit.event.entity.EntityEventgetEntityTypeMethods inherited from class org.bukkit.event.EventgetEventName, isAsynchronous
- 
Constructor Details- 
EntityKnockbackEventpublic EntityKnockbackEvent(@NotNull LivingEntity entity, @NotNull EntityKnockbackEvent.KnockbackCause cause, double force, @NotNull Vector rawKnockback, @NotNull Vector knockback) 
 
- 
- 
Method Details- 
getEntityDescription copied from class:EntityEventReturns the Entity involved in this event- Overrides:
- getEntityin class- EntityEvent
- Returns:
- Entity who is involved in this event
 
- 
getCauseGets the cause of the knockback.- Returns:
- the cause of the knockback
 
- 
getForcepublic double getForce()Gets the raw force of the knockback.
 This value is based on factors such as theEnchantment.KNOCKBACKlevel of an attacker and theAttribute.KNOCKBACK_RESISTANCEof the entity.- Returns:
- the knockback force
 
- 
getKnockbackGets the raw knockback force that will be applied to the entity.
 This value is read-only, changes made to it will not have any effect on the final knockback received.- Returns:
- the raw knockback
- See Also:
 
- 
getFinalKnockbackGets the force that will be applied to the entity.
 In contrast togetKnockback()this value is affected by the entities current velocity and whether they are touching the ground.Note: this method returns a copy, changes must be applied with setFinalKnockback(Vector).- Returns:
- the final knockback
 
- 
setFinalKnockbackSets the force that will be applied to the entity.- Parameters:
- knockback- the force to apply
 
- 
isCancelledpublic 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 interface- Cancellable
- Returns:
- true if this event is cancelled
 
- 
setCancelledpublic void setCancelled(boolean cancel) Description copied from interface:CancellableSets 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:
- setCancelledin interface- Cancellable
- Parameters:
- cancel- true if you wish to cancel this event
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
 
-