Skip to content

Class endstone::BlockBreakEvent

ClassList > endstone > BlockBreakEvent

Called when a block is broken by a player. More...

  • #include <endstone/event/block/block_break_event.h>

Inherits the following classes: endstone::BlockEvent

Public Static Attributes

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

Public Functions

Type Name
BlockBreakEvent (Block & block, Player & player)
virtual std::string getEventName () override const
Player & getPlayer () const
Gets the Player that is breaking the block involved in this event.
virtual bool isCancellable () override const
~BlockBreakEvent () override

Public Functions inherited from endstone::BlockEvent

See endstone::BlockEvent

Type Name
BlockEvent (Block & block)
Block & getBlock () const
Gets the block involved in this event.
~BlockEvent () override

Public Functions inherited from endstone::Event

See endstone::Event

Type Name
Event (bool async=false)
Event (const Event &) = delete
virtual std::string getEventName () const = 0
bool isAsynchronous () const
virtual bool isCancellable () const = 0
bool isCancelled () const
Event & operator= (const Event &) = delete
void setCancelled (bool cancel)
virtual ~Event () = default

Detailed Description

If a BlockBreakEvent is cancelled, the block will not break and experience will not drop.

Public Static Attributes Documentation

variable NAME

const std::string endstone::BlockBreakEvent::NAME;

Public Functions Documentation

function BlockBreakEvent

inline explicit endstone::BlockBreakEvent::BlockBreakEvent (
    Block & block,
    Player & player
) 

function getEventName

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

Gets a user-friendly identifier for this event.

Returns:

name of this event

Implements endstone::Event::getEventName


function getPlayer

Gets the Player that is breaking the block involved in this event.

inline Player & endstone::BlockBreakEvent::getPlayer () const

Returns:

The Player that is breaking the block involved in this event


function isCancellable

inline virtual bool endstone::BlockBreakEvent::isCancellable () override const

Whether the event can be cancelled by a plugin or the server.

Returns:

true if this event can be cancelled

Implements endstone::Event::isCancellable


function ~BlockBreakEvent

endstone::BlockBreakEvent::~BlockBreakEvent () override


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