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::BlockEvent

Public Static Attributes

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

Public Functions

Type Name
BlockPlaceEvent (std::unique_ptr< BlockState > placed_block, Block & replaced_block, Block & placed_against, Player & player)
Block & getBlockAgainst () const
Gets the block that this block was placed against.
BlockState & getBlockPlacedState () const
Gets the BlockState for the block which was placed.
Block & getBlockReplaced () const
Gets the block which was replaced.
virtual std::string getEventName () override const
Player & getPlayer () const
Gets the player who placed the block involved in this event.
virtual bool isCancellable () override const
~BlockPlaceEvent () 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 BlockPlaceEvent is cancelled, the block will not be placed.

Public Static Attributes Documentation

variable NAME

const std::string endstone::BlockPlaceEvent::NAME;

Public Functions Documentation

function BlockPlaceEvent

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

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 getBlockPlacedState

Gets the BlockState for the block which was placed.

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

Returns:

The BlockState for the block which was placed.


function getBlockReplaced

Gets the block which was replaced.

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

Returns:

The Block which was replaced.


function getEventName

inline virtual std::string endstone::BlockPlaceEvent::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 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 isCancellable

inline virtual bool endstone::BlockPlaceEvent::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 ~BlockPlaceEvent

endstone::BlockPlaceEvent::~BlockPlaceEvent () override


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