Skip to content

Class endstone::ActorDamageEvent

ClassList > endstone > ActorDamageEvent

Called when an Actor is damaged.

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

Inherits the following classes: endstone::Cancellable

Public Static Attributes

Type Name
const std::string NAME = "ActorDamageEvent"

Public Functions

Type Name
ActorDamageEvent (Mob & actor, std::unique_ptr< DamageSource > damage_source, const float damage)
float getDamage () const
Gets the amount of damage caused by the event.
DamageSource & getDamageSource () const
Get the source of damage.
virtual std::string getEventName () override const
void setDamage (const float damage)
Sets the amount of damage caused by the event.

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 () 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)
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 Static Attributes Documentation

variable NAME

const std::string endstone::ActorDamageEvent::NAME;

Public Functions Documentation

function ActorDamageEvent

inline endstone::ActorDamageEvent::ActorDamageEvent (
    Mob & actor,
    std::unique_ptr< DamageSource > damage_source,
    const  float damage
) 

function getDamage

Gets the amount of damage caused by the event.

inline float endstone::ActorDamageEvent::getDamage () const

Returns:

The amount of damage caused by the event


function getDamageSource

Get the source of damage.

inline DamageSource & endstone::ActorDamageEvent::getDamageSource () const

Returns:

a DamageSource detailing the source of the damage.


function getEventName

inline virtual std::string endstone::ActorDamageEvent::getEventName () override const

Gets a user-friendly identifier for this event.

Returns:

name of this event

Implements endstone::Event::getEventName


function setDamage

Sets the amount of damage caused by the event.

inline void endstone::ActorDamageEvent::setDamage (
    const  float damage
) 

Parameters:

  • damage The amount of damage caused by the event


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