Skip to content

Class endstone::PlayerItemHeldEvent

ClassList > endstone > PlayerItemHeldEvent

Called when a player changes their currently held item.

  • #include <endstone/event/player/player_item_held_event.h>

Inherits the following classes: endstone::Cancellable

Public Functions

Type Name
PlayerItemHeldEvent (Player & player, const int previous, const int current)
int getNewSlot () const
Gets the new held slot index.
int getPreviousSlot () const
Gets the previous held slot index.

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 PlayerItemHeldEvent

inline explicit endstone::PlayerItemHeldEvent::PlayerItemHeldEvent (
    Player & player,
    const int previous,
    const int current
) 

function getNewSlot

Gets the new held slot index.

inline int endstone::PlayerItemHeldEvent::getNewSlot () const

Returns:

New slot index


function getPreviousSlot

Gets the previous held slot index.

inline int endstone::PlayerItemHeldEvent::getPreviousSlot () const

Returns:

Previous slot index



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