Skip to content

Class endstone::ActorKnockbackEvent

ClassList > endstone > ActorKnockbackEvent

Called when a living entity receives knockback.

  • #include <endstone/event/actor/actor_knockback_event.h>

Inherits the following classes: endstone::Cancellable

Public Functions

Type Name
ActorKnockbackEvent (Mob & mob, Actor * source, Vector knockback)
ENDSTONE_EVENT (ActorKnockbackEvent)
Vector getKnockback () const
Actor * getSource () const
Get the source actor that has caused knockback to the defender, if exists.
void setKnockback (Vector knockback)
Sets the knockback that will be applied to the entity.

Public Functions inherited from endstone::Cancellable

See endstone::Cancellable

Type Name
virtual void cancel ()
Cancel this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
virtual bool isCancelled () override const
Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
virtual void setCancelled (bool cancel) override
Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

Public Functions inherited from endstone::ICancellable

See endstone::ICancellable

Type Name
virtual void cancel () = 0
virtual bool isCancelled () const = 0
virtual void setCancelled (bool cancel) = 0
virtual ~ICancellable () = default

Public Functions Documentation

function ActorKnockbackEvent

inline explicit endstone::ActorKnockbackEvent::ActorKnockbackEvent (
    Mob & mob,
    Actor * source,
    Vector knockback
) 

function ENDSTONE_EVENT

endstone::ActorKnockbackEvent::ENDSTONE_EVENT (
    ActorKnockbackEvent
) 

function getKnockback

inline Vector endstone::ActorKnockbackEvent::getKnockback () const

Gets the knockback that will be applied to the entity.

Note: this method returns a copy, changes must be applied with setKnockback(Vector)

Returns:

the knockback


function getSource

Get the source actor that has caused knockback to the defender, if exists.

inline Actor * endstone::ActorKnockbackEvent::getSource () const

Returns:

actor that caused knockback, or nullptr if the knockback is not caused by an actor.


function setKnockback

Sets the knockback that will be applied to the entity.

inline void endstone::ActorKnockbackEvent::setKnockback (
    Vector knockback
) 

Parameters:

  • knockback the knockback to apply


The documentation for this class was generated from the following file include/endstone/event/actor/actor_knockback_event.h