Skip to content

Class endstone::BlockPlaceEvent

ClassList > endstone > BlockPlaceEvent

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

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

Inherits the following classes: endstone::Cancellable

Public Functions

Type Name
BlockPlaceEvent (std::unique_ptr< Block > placed_block, std::unique_ptr< BlockState > replaced_state, std::unique_ptr< Block > placed_against, Player & player)
ENDSTONE_EVENT (BlockPlaceEvent)
Block & getBlockAgainst () const
Gets the block that this block was placed against.
Block & getBlockPlaced () const
Gets the block placed.
BlockState & getBlockReplacedState () const
Gets the BlockState for the block which was replaced.
Player & getPlayer () const
Gets the player who placed the block involved in this event.
~BlockPlaceEvent () override

Public Functions inherited from endstone::Cancellable

See endstone::Cancellable

Type Name
virtual void cancel ()
Cancel this event.
virtual bool isCancelled () override const
Gets the cancellation state of this event.
virtual void setCancelled (bool cancel) override
Sets the cancellation state of this event.

Public Functions inherited from endstone::ICancellable

See endstone::ICancellable

Type Name
virtual void cancel () = 0
Cancels this event.
virtual bool isCancelled () const = 0
Gets the cancellation state of this event.
virtual void setCancelled (bool cancel) = 0
Sets the cancellation state of this event.
virtual ~ICancellable () = default

Detailed Description

If a BlockPlaceEvent is cancelled, the block will not be placed.

Public Functions Documentation

function BlockPlaceEvent

inline explicit endstone::BlockPlaceEvent::BlockPlaceEvent (
    std::unique_ptr< Block > placed_block,
    std::unique_ptr< BlockState > replaced_state,
    std::unique_ptr< Block > placed_against,
    Player & player
) 

function ENDSTONE_EVENT

endstone::BlockPlaceEvent::ENDSTONE_EVENT (
    BlockPlaceEvent
) 

function getBlockAgainst

Gets the block that this block was placed against.

inline Block & endstone::BlockPlaceEvent::getBlockAgainst () const

Returns:

Block the block that the new block was placed against


function getBlockPlaced

Gets the block placed.

inline Block & endstone::BlockPlaceEvent::getBlockPlaced () const

Returns:

The Block that was placed.


function getBlockReplacedState

Gets the BlockState for the block which was replaced.

inline BlockState & endstone::BlockPlaceEvent::getBlockReplacedState () const

Returns:

The BlockState of the block that was replaced.


function getPlayer

Gets the player who placed the block involved in this event.

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

Returns:

The Player who placed the block involved in this event


function ~BlockPlaceEvent

endstone::BlockPlaceEvent::~BlockPlaceEvent () override


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