Class EntityKnockbackEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
io.papermc.paper.event.entity.EntityKnockbackEvent
All Implemented Interfaces:
Cancellable
Direct Known Subclasses:
EntityPushedByEntityAttackEvent

public class EntityKnockbackEvent extends EntityEvent implements Cancellable
Called when an entity receives knockback.
See Also:
  • Field Details

    • knockback

      protected Vector knockback
  • Constructor Details

  • Method Details

    • getCause

      public @NonNull EntityKnockbackEvent.Cause getCause()
      Gets the cause of the knockback.
      Returns:
      the cause of the knockback
    • getKnockback

      public @NonNull Vector getKnockback()
      Gets the 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. Use setKnockback(Vector) to make changes.
      Returns:
      the knockback
    • setKnockback

      public void setKnockback(@NonNull Vector knockback)
      Sets the knockback force that will be applied to the entity.
      Parameters:
      knockback - the knockback
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Gets 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:
      isCancelled in interface Cancellable
      Returns:
      true if this event is cancelled
    • setCancelled

      public void setCancelled(boolean cancel)
      Description copied from interface: Cancellable
      Sets 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:
      setCancelled in interface Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
    • getHandlers

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

      public static @NonNull HandlerList getHandlerList()