endstone/event

Classes

NameDescription
ActorDamageEventCalled when an Actor is damaged.
ActorDeathEventCalled when an Actor dies.
ActorEventRepresents an Actor-related event.
ActorExplodeEventCalled when an actor explodes.
ActorKnockbackEventCalled when a living entity receives knockback.
ActorRemoveEventCalled when an Actor is removed.
ActorSpawnEventCalled when an Actor is spawned into a world.
ActorTeleportEventCalled when a non-player entity is teleported from one location to another.
BlockBreakEventCalled when a block is broken by a player.
BlockCookEventCalled when an ItemStack is successfully cooked in a block.
BlockEventRepresents an Block-related event.
BlockExplodeEventCalled when a block explodes (e.g. bed in the Nether, respawn anchor in the Overworld).
BlockFormEventCalled when a block is formed or spreads based on world conditions.
BlockFromToEventRepresents events with a source block and a destination block, currently only applies to liquid (lava and water) and teleporting dragon eggs.
BlockGrowEventCalled when a block grows naturally in the world.
BlockPistonEventCalled when a piston block is triggered.
BlockPistonExtendEventCalled when a piston extends.
BlockPistonRetractEventCalled when a piston retracts.
BlockPlaceEventCalled when a block is placed by a player.
BroadcastMessageEventEvent triggered for server broadcast messages such as from Server::broadcast.
CancellableA type characterizing events that may be cancelled by a plugin or the server.
ChunkEventRepresents a Chunk related event.
ChunkLoadEventCalled when a chunk is loaded.
ChunkUnloadEventCalled when a chunk is unloaded.
DimensionEventRepresents events within a level.
EventRepresents an event.
EventHandlerRepresents a registered EventHandler which associates with a Plugin.
HandlerListA list of event handlers. Should be instantiated on a per-event basis.
ICancellable
LeavesDecayEventCalled when leaves are decaying naturally.
LevelEventRepresents events within a level.
MapInitializeEventCalled when a map is initialized.
PacketReceiveEventCalled when the server receives a packet from a connected client.
PacketSendEventCalled when the server sends a packet to a connected client.
PlayerBedEnterEventCalled when a player is almost about to enter the bed.
PlayerBedLeaveEventCalled when a player is leaving a bed.
PlayerChatEventCalled when a player sends a chat message.
PlayerCommandEventCalled whenever a player runs a command.
PlayerDeathEventCalled when a Player dies.
PlayerDimensionChangeEventCalled when a player switches to another dimension.
PlayerDropItemEventCalled when a player drops an item from their inventory.
PlayerEmoteEventCalled when a player uses an emote.
PlayerEventRepresents a player related event.
PlayerGameModeChangeEventCalled when the GameMode of the player is changed.
PlayerInteractActorEventRepresents an event that is called when a player right-clicks an actor.
PlayerInteractEventRepresents an event that is called when a player interacts with an object or air.
PlayerItemConsumeEventCalled when a player is finishing consuming an item (food, potion, milk bucket).
PlayerItemHeldEventCalled when a player changes their currently held item.
PlayerJoinEventCalled when a player joins a server.
PlayerJumpEventCalled when a player jumps.
PlayerKickEventCalled when a player gets kicked from the server.
PlayerLoginEventCalled when a player attempts to login in.
PlayerMoveEventCalled when a player moves.
PlayerPickupItemEventCalled when a player picks an item up from the ground.
PlayerPortalEventCalled when a player is about to teleport because it is in contact with a portal.
PlayerQuitEventCalled when a player leaves a server.
PlayerRespawnEventCalled when a player respawns.
PlayerSkinChangeEventCalled when a player changes their skin.
PlayerTeleportEventCalled when a player is teleported from one location to another.
PluginDisableEventCalled when a plugin is disabled.
PluginEnableEventCalled when a plugin is enabled.
ScriptMessageEventCalled when a message is sent by /scriptevent command.
ServerCommandEventCalled when the console runs a command, early in the process.
ServerEventRepresents a Server-related event.
ServerListPingEventCalled when a server ping is coming in.
ServerLoadEventCalled when either the server startup or reload has completed.
ThunderChangeEventCalled when the thunder state in a world is changing.
WeatherChangeEventCalled when the weather (rain) state in a world is changing.
WeatherEventRepresents a Weather-related event.

Enums

NameDescription
EventPriorityRepresents an event's priority in execution.
EventResult

classActorDamageEvent

Defined in <endstone/event/actor/actor_damage_event.h>

Bases: Cancellable<ActorEvent<Mob>>

Called when an Actor is damaged.

Methods

NameDescription
ENDSTONE_EVENT
ActorDamageEvent
getDamageGets the raw amount of damage caused by the event.
setDamageSets the raw amount of damage caused by the event.
getDamageSourceGet the source of damage.

methENDSTONE_EVENT

ENDSTONE_EVENT(ActorDamageEvent)

methActorDamageEvent

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

methgetDamageconst

float getDamage() const

Gets the raw amount of damage caused by the event.

Returns

TypeDescription
floatThe raw amount of damage caused by the event

methsetDamage

void setDamage(const float damage)

Sets the raw amount of damage caused by the event.

Parameters

NameTypeDescription
damageconst floatThe raw amount of damage caused by the event

methgetDamageSourceconst

DamageSource& getDamageSource() const

Get the source of damage.

Returns

TypeDescription
DamageSource&a DamageSource detailing the source of the damage.

classActorDeathEvent

Defined in <endstone/event/actor/actor_death_event.h>

Bases: ActorEvent<Mob>

Called when an Actor dies.

Methods

NameDescription
ENDSTONE_EVENT
ActorDeathEvent
getDamageSourceGets the source of damage which caused the death.

methENDSTONE_EVENT

ENDSTONE_EVENT(ActorDeathEvent)

methActorDeathEvent

ActorDeathEvent(Mob& actor, std::unique_ptr<DamageSource> damage_source)

methgetDamageSourceconst

DamageSource& getDamageSource() const

Gets the source of damage which caused the death.

Returns

TypeDescription
DamageSource&a DamageSource detailing the source of the damage for the death.

classActorEvent

Defined in <endstone/event/actor/actor_event.h>

Bases: Event

Represents an Actor-related event.

Methods

NameDescription
ActorEvent
~ActorEvent
getActorReturns the Actor involved in this event.

methActorEventexplicit

ActorEvent(ActorType& actor)

meth~ActorEvent

~ActorEvent() override=default

methgetActorconst

ActorType& getActor() const

Returns the Actor involved in this event.

Returns

TypeDescription
ActorType&Actor which is involved in this event

classActorExplodeEvent

Defined in <endstone/event/actor/actor_explode_event.h>

Bases: Cancellable<ActorEvent<Actor>>

Called when an actor explodes.

Methods

NameDescription
ENDSTONE_EVENT
ActorExplodeEvent
~ActorExplodeEvent
getLocationReturns the location where the explosion happened.
getBlockListReturns the list of blocks that would have been removed or were removed from the explosion event.
getBlockListReturns the list of blocks that would have been removed or were removed from the explosion event.

methENDSTONE_EVENT

ENDSTONE_EVENT(ActorExplodeEvent)

methActorExplodeEventexplicit

ActorExplodeEvent(Actor& actor, Location location, BlockList blocks)

meth~ActorExplodeEvent

~ActorExplodeEvent() override=default

methgetLocationconst

const Location& getLocation() const

Returns the location where the explosion happened.

It is not possible to get this value from the Entity as the Entity no longer exists in the world.

Returns

TypeDescription
const Location&The location of the explosion

methgetBlockListconst

const BlockList& getBlockList() const

Returns the list of blocks that would have been removed or were removed from the explosion event.

Returns

TypeDescription
const BlockList&All blown-up blocks

methgetBlockList

BlockList& getBlockList()

Returns the list of blocks that would have been removed or were removed from the explosion event.

Returns

TypeDescription
BlockList&All blown-up blocks

classActorKnockbackEvent

Defined in <endstone/event/actor/actor_knockback_event.h>

Bases: Cancellable<ActorEvent<Mob>>

Called when a living entity receives knockback.

Methods

NameDescription
ENDSTONE_EVENT
ActorKnockbackEvent
getSourceGet the source actor that has caused knockback to the defender, if exists.
getKnockback
setKnockbackSets the knockback that will be applied to the entity.

methENDSTONE_EVENT

ENDSTONE_EVENT(ActorKnockbackEvent)

methActorKnockbackEventexplicit

ActorKnockbackEvent(Mob& mob, Actor* source, Vector knockback)

methgetSourceconst

Actor* getSource() const

Get the source actor that has caused knockback to the defender, if exists.

Returns

TypeDescription
Actor*actor that caused knockback, or nullptr if the knockback is not caused by an actor.

methgetKnockbackconst

Vector getKnockback() const

Gets the knockback that will be applied to the entity.

Note: this method returns a copy, changes must be applied with setKnockback(Vector)

Returns

TypeDescription
Vectorthe knockback

methsetKnockback

void setKnockback(Vector knockback)

Sets the knockback that will be applied to the entity.

Parameters

NameTypeDescription
knockbackVectorthe knockback to apply

classActorRemoveEvent

Defined in <endstone/event/actor/actor_remove_event.h>

Bases: ActorEvent<Actor>

Called when an Actor is removed.

This event should only be used for monitoring. Modifying the actor during or after this event leads to undefined behaviours. This event will not be called for Players.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(ActorRemoveEvent)

methActorEventexplicit

ActorEvent(ActorType& actor)

classActorSpawnEvent

Defined in <endstone/event/actor/actor_spawn_event.h>

Bases: Cancellable<ActorEvent<Actor>>

Called when an Actor is spawned into a world.

If an Actor Spawn event is cancelled, the actor will not spawn.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(ActorSpawnEvent)

methActorSpawnEventexplicit

ActorSpawnEvent(Actor& actor)

meth~ActorSpawnEvent

~ActorSpawnEvent() override=default

classActorTeleportEvent

Defined in <endstone/event/actor/actor_teleport_event.h>

Bases: Cancellable<ActorEvent<Actor>>

Called when a non-player entity is teleported from one location to another.

This may be as a result of natural causes (Enderman, Shulker), pathfinding (Wolf), or commands (/teleport).

Methods

NameDescription
ENDSTONE_EVENT
ActorTeleportEvent
~ActorTeleportEvent
getFromGets the location that this actor moved from.
setFromSets the location that this actor moved from.
getToGets the location that this actor moved to.
setToSets the location that this actor moved to.

methENDSTONE_EVENT

ENDSTONE_EVENT(ActorTeleportEvent)

methActorTeleportEventexplicit

ActorTeleportEvent(Actor& actor, Location from, Location to)

meth~ActorTeleportEvent

~ActorTeleportEvent() override=default

methgetFromconst

const Location& getFrom() const

Gets the location that this actor moved from.

Returns

TypeDescription
const Location&Location this actor moved from

methsetFrom

void setFrom(const Location& from)

Sets the location that this actor moved from.

Parameters

NameTypeDescription
fromconst Location&New location this actor moved from

methgetToconst

const Location& getTo() const

Gets the location that this actor moved to.

Returns

TypeDescription
const Location&Location this actor moved to

methsetTo

void setTo(const Location& to)

Sets the location that this actor moved to.

Parameters

NameTypeDescription
toconst Location&New Location this actor moved to

classBlockBreakEvent

Defined in <endstone/event/block/block_break_event.h>

Bases: Cancellable<BlockEvent>

Called when a block is broken by a player.

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

Methods

NameDescription
ENDSTONE_EVENT
BlockBreakEvent
~BlockBreakEvent
getPlayerGets the Player that is breaking the block involved in this event.

methENDSTONE_EVENT

ENDSTONE_EVENT(BlockBreakEvent)

methBlockBreakEventexplicit

BlockBreakEvent(std::unique_ptr<Block> block, Player& player)

meth~BlockBreakEvent

~BlockBreakEvent() override=default

methgetPlayerconst

Player& getPlayer() const

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

Returns

TypeDescription
Player&The Player that is breaking the block involved in this event

classBlockCookEvent

Defined in <endstone/event/block/block_cook_event.h>

Bases: Cancellable<BlockEvent>

Called when an ItemStack is successfully cooked in a block.

Methods

NameDescription
ENDSTONE_EVENT
BlockCookEvent
getSourceGets the smelted ItemStack for this event.
getResultGets the resultant ItemStack for this event.
setResultSets the resultant ItemStack for this event.

methENDSTONE_EVENT

ENDSTONE_EVENT(BlockCookEvent)

methBlockCookEvent

BlockCookEvent(std::unique_ptr<Block> block, ItemStack source, ItemStack result)

methgetSourceconst

const ItemStack& getSource() const

Gets the smelted ItemStack for this event.

Returns

TypeDescription
const ItemStack&smelting source ItemStack

methgetResultconst

const ItemStack& getResult() const

Gets the resultant ItemStack for this event.

Returns

TypeDescription
const ItemStack&smelting result ItemStack

methsetResult

void setResult(ItemStack result)

Sets the resultant ItemStack for this event.

Parameters

NameTypeDescription
resultItemStacknew result ItemStack

classBlockEvent

Defined in <endstone/event/block/block_event.h>

Bases: Event

Represents an Block-related event.

Variables

NameDescription
block_

Methods

NameDescription
BlockEvent
getBlockGets the block involved in this event.

varblock_protected

methBlockEventexplicit

BlockEvent(std::unique_ptr<Block> block)

methgetBlockconst

Block& getBlock() const

Gets the block involved in this event.

Returns

TypeDescription
Block&The Block which block is involved in this event

classBlockExplodeEvent

Defined in <endstone/event/block/block_explode_event.h>

Bases: Cancellable<BlockEvent>

Called when a block explodes (e.g. bed in the Nether, respawn anchor in the Overworld).

If a BlockExplodeEvent is cancelled, the explosion will not occur.

Methods

NameDescription
ENDSTONE_EVENT
BlockExplodeEvent
~BlockExplodeEvent
getBlockListReturns the list of blocks that would have been removed or were removed from the explosion event.
getBlockListReturns the list of blocks that would have been removed or were removed from the explosion event.

methENDSTONE_EVENT

ENDSTONE_EVENT(BlockExplodeEvent)

methBlockExplodeEventexplicit

BlockExplodeEvent(std::unique_ptr<Block> block, BlockList blocks)

meth~BlockExplodeEvent

~BlockExplodeEvent() override=default

methgetBlockListconst

const BlockList& getBlockList() const

Returns the list of blocks that would have been removed or were removed from the explosion event.

Returns

TypeDescription
const BlockList&All blown-up blocks

methgetBlockList

BlockList& getBlockList()

Returns the list of blocks that would have been removed or were removed from the explosion event.

Returns

TypeDescription
BlockList&All blown-up blocks

classBlockFormEvent

Defined in <endstone/event/block/block_form_event.h>

Bases: BlockGrowEvent

Called when a block is formed or spreads based on world conditions.

Use BlockSpreadEvent to catch blocks that actually spread and don't just "randomly" form.

Examples:

  • Snow forming due to a snow storm.
  • Ice forming in a snowy Biome like Taiga or Tundra.
  • Obsidian / Cobblestone forming due to contact with water.
  • Concrete forming due to mixing of concrete powder and water.

If a BlockForm event is cancelled, the block will not be formed.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(BlockFormEvent)

methBlockGrowEventexplicit

BlockGrowEvent(std::unique_ptr<Block> block, std::unique_ptr<BlockState> new_state)

classBlockFromToEvent

Defined in <endstone/event/block/block_from_to_event.h>

Bases: Cancellable<BlockEvent>

Represents events with a source block and a destination block, currently only applies to liquid (lava and water) and teleporting dragon eggs.

If a Block From To event is cancelled, the block will not move (the liquid will not flow).

Variables

NameDescription
to_

Methods

NameDescription
ENDSTONE_EVENT
BlockFromToEvent
getToBlockConvenience method for getting the faced Block.

varto_protected

methENDSTONE_EVENT

ENDSTONE_EVENT(BlockFromToEvent)

methBlockFromToEventexplicit

BlockFromToEvent(std::unique_ptr<Block> block, std::unique_ptr<Block> to_block)

methgetToBlockconst

Block& getToBlock() const

Convenience method for getting the faced Block.

Returns

TypeDescription
Block&The faced Block

classBlockGrowEvent

Defined in <endstone/event/block/block_grow_event.h>

Bases: Cancellable<BlockEvent>

Called when a block grows naturally in the world.

If a Block Grow event is cancelled, the block will not grow.

Methods

NameDescription
ENDSTONE_EVENT
BlockGrowEvent
getNewStateGets the state of the block where it will form or spread to.

methENDSTONE_EVENT

ENDSTONE_EVENT(BlockGrowEvent)

methBlockGrowEventexplicit

BlockGrowEvent(std::unique_ptr<Block> block, std::unique_ptr<BlockState> new_state)

methgetNewStateconst

BlockState& getNewState() const

Gets the state of the block where it will form or spread to.

Returns

TypeDescription
BlockState&The block state for this events block

classBlockPistonEvent

Defined in <endstone/event/block/block_piston_event.h>

Bases: Cancellable<BlockEvent>

Called when a piston block is triggered.

Methods

NameDescription
BlockPistonEvent
getDirectionReturn the direction in which the piston will operate.

methBlockPistonEventexplicit

BlockPistonEvent(std::unique_ptr<Block> block, BlockFace direction)

methgetDirectionconst

BlockFace getDirection() const

Return the direction in which the piston will operate.

Returns

TypeDescription
BlockFacedirection of the piston

classBlockPistonExtendEvent

Defined in <endstone/event/block/block_piston_extend_event.h>

Bases: BlockPistonEvent

Called when a piston extends.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(BlockPistonExtendEvent)

methBlockPistonEventexplicit

BlockPistonEvent(std::unique_ptr<Block> block, BlockFace direction)

classBlockPistonRetractEvent

Defined in <endstone/event/block/block_piston_retract_event.h>

Bases: BlockPistonEvent

Called when a piston retracts.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(BlockPistonRetractEvent)

methBlockPistonEventexplicit

BlockPistonEvent(std::unique_ptr<Block> block, BlockFace direction)

classBlockPlaceEvent

Defined in <endstone/event/block/block_place_event.h>

Bases: Cancellable<BlockEvent>

Called when a block is placed by a player.

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

Methods

NameDescription
ENDSTONE_EVENT
BlockPlaceEvent
~BlockPlaceEvent
getPlayerGets the player who placed the block involved in this event.
getBlockPlacedStateGets the BlockState for the block which was placed.
getBlockReplacedGets the block which was replaced.
getBlockAgainstGets the block that this block was placed against.

methENDSTONE_EVENT

ENDSTONE_EVENT(BlockPlaceEvent)

methBlockPlaceEventexplicit

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

meth~BlockPlaceEvent

~BlockPlaceEvent() override=default

methgetPlayerconst

Player& getPlayer() const

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

Returns

TypeDescription
Player&The Player who placed the block involved in this event

methgetBlockPlacedStateconst

BlockState& getBlockPlacedState() const

Gets the BlockState for the block which was placed.

Returns

TypeDescription
BlockState&The BlockState for the block which was placed.

methgetBlockReplacedconst

Block& getBlockReplaced() const

Gets the block which was replaced.

Returns

TypeDescription
Block&The Block which was replaced.

methgetBlockAgainstconst

Block& getBlockAgainst() const

Gets the block that this block was placed against.

Returns

TypeDescription
Block&Block the block that the new block was placed against

classBroadcastMessageEvent

Defined in <endstone/event/server/broadcast_message_event.h>

Bases: Cancellable<ServerEvent>

Event triggered for server broadcast messages such as from Server::broadcast.

This event should be async if fired from an async thread.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(BroadcastMessageEvent)

methBroadcastMessageEvent

BroadcastMessageEvent(bool async, Message message, std::unordered_set<const CommandSender*> recipients)

methgetMessageconst

const Message& getMessage() const

Get the message to broadcast.

Returns

TypeDescription
const Message&Message to broadcast

methsetMessage

void setMessage(Message message)

Set the message to broadcast.

Parameters

NameTypeDescription
messageMessageNew message to broadcast

methgetRecipientsconst

const std::unordered_set<const CommandSender*>& getRecipients() const

Gets a set of recipients that this broadcast message will be displayed to.

Returns

TypeDescription
const std::unordered_set<const CommandSender*>&All CommandSenders who will see this broadcast message

classCancellable

Defined in <endstone/event/cancellable.h>

Bases: EventType, ICancellable

A type characterizing events that may be cancelled by a plugin or the server.

Methods

NameDescription
isCancelledGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
setCancelledSets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
cancelCancel this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

methisCancelledvirtualconstoverride

bool isCancelled() const override

Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

Returns

TypeDescription
booltrue if this event is cancelled

methsetCancelledvirtualoverride

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.

Parameters

NameTypeDescription
cancelbooltrue if you wish to cancel this event

methcancelvirtualoverride

void cancel() final

Cancel this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

classChunkEvent

Defined in <endstone/event/chunk/chunk_event.h>

Bases: DimensionEvent

Represents a Chunk related event.

Methods

NameDescription
ChunkEvent
getChunk

methChunkEventexplicit

ChunkEvent(Chunk& chunk)

methgetChunkconst

Chunk& getChunk() const

Gets the chunk being loaded/unloaded

Returns

TypeDescription
Chunk&Chunk that triggered this event

classChunkLoadEvent

Defined in <endstone/event/chunk/chunk_load_event.h>

Bases: ChunkEvent

Called when a chunk is loaded.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(ChunkLoadEvent)

methChunkLoadEventexplicit

ChunkLoadEvent(Chunk& chunk)

meth~ChunkLoadEvent

~ChunkLoadEvent() override=default

classChunkUnloadEvent

Defined in <endstone/event/chunk/chunk_unload_event.h>

Bases: ChunkEvent

Called when a chunk is unloaded.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(ChunkUnloadEvent)

methChunkUnloadEventexplicit

ChunkUnloadEvent(Chunk& chunk)

meth~ChunkUnloadEvent

~ChunkUnloadEvent() override=default

classDimensionEvent

Defined in <endstone/event/level/dimension_event.h>

Bases: LevelEvent

Represents events within a level.

Methods

methDimensionEventexplicit

DimensionEvent(Dimension& dimension)

methgetDimensionconst

Dimension& getDimension() const

Gets the dimension primarily involved with this event

Returns

TypeDescription
Dimension&Dimension which caused this event

classEvent

Defined in <endstone/event/event.h>

Represents an event.

Methods

methEventexplicit

Event(bool async = false)

methEvent

Event(const Event&) =delete

methoperator=

Event& operator=(const Event&) =delete

methEvent

Event(Event&&) =default

methoperator=

Event& operator=(Event&&) =default

meth~Eventvirtual

~Event() =default

methgetEventNameabstractconst

std::string getEventName() const =0

Gets a user-friendly identifier for this event.

Returns

TypeDescription
std::stringname of this event

methisAsynchronousconst

bool isAsynchronous() const

Any custom event that should not by synchronized with other events must use the specific constructor.

Returns

TypeDescription
boolfalse by default, true if the event fires asynchronously

classEventHandler

Defined in <endstone/event/event_handler.h>

Represents a registered EventHandler which associates with a Plugin.

Methods

methEventHandler

EventHandler(std::string event, std::function<void(Event&)> executor, EventPriority priority, Plugin& plugin, bool ignore_cancelled)

methgetPluginconst

Plugin& getPlugin() const

Gets the plugin for this registration

Returns

TypeDescription
Plugin&Registered Plugin

methgetPriorityconst

EventPriority getPriority() const

Gets the priority for this registration

Returns

TypeDescription
EventPriorityRegistered Priority

methisIgnoreCancelledconst

bool isIgnoreCancelled() const

Whether this listener accepts cancelled events

Returns

TypeDescription
boolTrue when ignoring cancelled events

methcallEventconst

void callEvent(Event& event) const

Calls the event executor

Parameters

NameTypeDescription
eventEvent&The event

methgetEventTypeconst

std::string getEventType() const

Gets the event type for this registration

Returns

TypeDescription
std::stringRegistered event type

classHandlerList

Defined in <endstone/event/handler_list.h>

A list of event handlers. Should be instantiated on a per-event basis.

Methods

methHandlerListexplicit

HandlerList(std::string event)

methregisterHandler

EventHandler* registerHandler(std::unique_ptr<EventHandler> handler)

Register a new handler

Parameters

NameTypeDescription
handlerstd::unique_ptr<EventHandler>Event handler to register

Returns

TypeDescription
EventHandler*the pointer to the registered handler

methunregister

void unregister(const EventHandler& handler)

Remove a handler from a specific order slot

Parameters

NameTypeDescription
handlerconst EventHandler&Event handler to remove

methunregister

void unregister(const Plugin& plugin)

Remove a specific plugin's handlers from this handler

Parameters

NameTypeDescription
pluginconst Plugin&Plugin to remove

methgetHandlersconst

std::vector<EventHandler*> getHandlers() const

Get the baked registered handlers associated with this handler list

Returns

TypeDescription
std::vector<EventHandler*>the array of registered handlers

methbakeconstprotected

void bake() const

classICancellable

Defined in <endstone/event/cancellable.h>

Methods

meth~ICancellablevirtual

~ICancellable() =default

methisCancelledabstractconst

bool isCancelled() const =0

methsetCancelledabstract

void setCancelled(bool cancel) =0

methcancelabstract

void cancel() =0

classLeavesDecayEvent

Defined in <endstone/event/block/leaves_decay_event.h>

Bases: Cancellable<BlockEvent>

Called when leaves are decaying naturally.

Note

If a Leaves Decay event is cancelled, the leaves will not decay.

Methods

NameDescription
ENDSTONE_EVENT

methENDSTONE_EVENT

ENDSTONE_EVENT(LeavesDecayEvent)

classLevelEvent

Defined in <endstone/event/level/level_event.h>

Bases: Event

Represents events within a level.

Methods

NameDescription
LevelEvent
getLevel

methLevelEventexplicit

LevelEvent(Level& level)

methgetLevelconst

Level& getLevel() const

Gets the level primarily involved with this event

Returns

TypeDescription
Level&Level which caused this event

classMapInitializeEvent

Defined in <endstone/event/server/map_initialize_event.h>

Bases: ServerEvent

Called when a map is initialized.

Methods

NameDescription
MapInitializeEvent
getMapGets the map initialized in this event.

methMapInitializeEventexplicit

MapInitializeEvent(MapView& map)

methgetMapconst

MapView& getMap() const

Gets the map initialized in this event.

Returns

TypeDescription
MapView&Map for this event

classPacketReceiveEvent

Defined in <endstone/event/server/packet_receive_event.h>

Bases: Cancellable<ServerEvent>

Called when the server receives a packet from a connected client.

Methods

NameDescription
ENDSTONE_EVENT
PacketReceiveEvent
getPacketIdGets the ID of the packet.
getPayloadGets the raw packet data excluding the header.
setPayloadSets the raw packet data excluding the header.
getPlayerReturns the player involved in this event.
getAddressGets the network address to which this packet is being sent.
getSubClientIdGets the SubClient ID.

methENDSTONE_EVENT

ENDSTONE_EVENT(PacketReceiveEvent)

methPacketReceiveEvent

PacketReceiveEvent(Player* player, const int packet_id, std::string_view payload, SocketAddress address, const int sub_client_id)

methgetPacketIdconst

int getPacketId() const

Gets the ID of the packet.

Returns

TypeDescription
intThe packet ID.

methgetPayloadconst

std::string_view getPayload() const

Gets the raw packet data excluding the header.

Returns

TypeDescription
std::string_viewThe packet payload data.

methsetPayload

void setPayload(std::string_view payload)

Sets the raw packet data excluding the header.

Returns

TypeDescription
voidThe packet payload data.

methgetPlayerconst

Player* getPlayer() const

Returns the player involved in this event.

Note

This may return nullptr if the packet is sent before the player completes the login process.

Returns

TypeDescription
Player*Player who is involved in this event

methgetAddressconst

SocketAddress getAddress() const

Gets the network address to which this packet is being sent.

Returns

TypeDescription
SocketAddressThe SocketAddress of the destination client.

methgetSubClientIdconst

int getSubClientId() const

Gets the SubClient ID.

Note

Range is 0 to 3 (0 = primary client; 1-3 = split-screen clients).

Returns

TypeDescription
intThe SubClient ID.

classPacketSendEvent

Defined in <endstone/event/server/packet_send_event.h>

Bases: Cancellable<ServerEvent>

Called when the server sends a packet to a connected client.

Methods

NameDescription
ENDSTONE_EVENT
PacketSendEvent
getPacketIdGets the ID of the packet.
getPayloadGets the raw packet data excluding the header.
setPayloadSets the raw packet data excluding the header.
getPlayerReturns the player involved in this event.
getAddressGets the network address to which this packet is being sent.
getSubClientIdGets the SubClient ID.

methENDSTONE_EVENT

ENDSTONE_EVENT(PacketSendEvent)

methPacketSendEvent

PacketSendEvent(Player* player, const int packet_id, std::string_view payload, SocketAddress address, const int sub_client_id)

methgetPacketIdconst

int getPacketId() const

Gets the ID of the packet.

Returns

TypeDescription
intThe packet ID.

methgetPayloadconst

std::string_view getPayload() const

Gets the raw packet data excluding the header.

Returns

TypeDescription
std::string_viewThe packet payload data.

methsetPayload

void setPayload(std::string_view payload)

Sets the raw packet data excluding the header.

Returns

TypeDescription
voidThe packet payload data.

methgetPlayerconst

Player* getPlayer() const

Returns the player involved in this event.

Note

This may return nullptr if the packet is sent before the player completes the login process.

Returns

TypeDescription
Player*Player who is involved in this event

methgetAddressconst

SocketAddress getAddress() const

Gets the network address to which this packet is being sent.

Returns

TypeDescription
SocketAddressThe SocketAddress of the destination client.

methgetSubClientIdconst

int getSubClientId() const

Gets the SubClient ID.

Note

Range is 0 to 3 (0 = primary client; 1-3 = split-screen clients).

Returns

TypeDescription
intThe SubClient ID.

classPlayerBedEnterEvent

Defined in <endstone/event/player/player_bed_enter_event.h>

Bases: Cancellable<PlayerEvent>

Called when a player is almost about to enter the bed.

Methods

NameDescription
PlayerBedEnterEvent
getBedRepresents the default possible outcomes of this event.

methPlayerBedEnterEventexplicit

PlayerBedEnterEvent(Player& player, Block& bed)

methgetBedconst

Block& getBed() const

Represents the default possible outcomes of this event.

The player will enter the bed. The dimension doesn't allow sleeping or saving the spawn point (eg,Nether, The End). Entering the bed is prevented due to it not being night nor thundering currently. Entering the bed is prevented due to the player being too far away. Entering the bed is prevented due to there being monsters nearby. Entering the bed is prevented due to there being some other problem.

This describes the default outcome of this event.

This controls the action to take with the bed that was clicked on.

Sets the action to take with the interacted bed.

  • Result::Allow will result in the player sleeping, regardless of the default outcome described by getBedEnterResult().
  • Result::Deny will prevent the player from sleeping. This has the same effect as canceling the event
  • Result::Default will result in the outcome described by getBedEnterResult().

Gets the cancellation state of this event. Set to true if you want to prevent the player from sleeping.

Note

Canceling the event has the same effect as setting useBed() to Result::Deny.

Note

Canceling this event will prevent use of the bed.

Returns the bed block involved in this event.

Parameters

NameTypeDescription
use_bedthe action to take with the interacted bed
canceltrue if you wish to cancel this event

Returns

TypeDescription
Block&The bed enter result representing the default outcome of this eventthe action to take with the interacted bedboolean cancellation state
      @brief Sets the cancellation state of this event. A canceled event will not be executed in the server, but
will still pass to other plugins.The bed block involved in this event.

classPlayerBedLeaveEvent

Defined in <endstone/event/player/player_bed_leave_event.h>

Bases: PlayerEvent

Called when a player is leaving a bed.

Methods

NameDescription
PlayerBedLeaveEvent
~PlayerBedLeaveEvent
getBedReturns the bed block involved in this event.

methPlayerBedLeaveEventexplicit

PlayerBedLeaveEvent(Player& player, Block& bed)

meth~PlayerBedLeaveEvent

~PlayerBedLeaveEvent() override=default

methgetBedconst

Block& getBed() const

Returns the bed block involved in this event.

Returns

TypeDescription
Block&The bed block involved in this event.

classPlayerChatEvent

Defined in <endstone/event/player/player_chat_event.h>

Bases: Cancellable<PlayerEvent>

Called when a player sends a chat message.

Methods

NameDescription
ENDSTONE_EVENT
PlayerChatEvent
getMessageGets the message that the player is attempting to send.
setMessageSets the message that the player will send.
setPlayerSets the player that this message will display as.
getFormatGets the format to use to display this chat message.
setFormatSets the format to use to display this chat message.
getRecipientsGets a set of recipients that this chat message will be displayed to.

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerChatEvent)

methPlayerChatEventexplicit

PlayerChatEvent(Player& player, std::string message, std::optional<std::vector<Player*>> recipients, std::string format = "<{0}> {1}")

methgetMessageconst

std::string getMessage() const

Gets the message that the player is attempting to send.

Returns

TypeDescription
std::stringMessage the player is attempting to send

methsetMessage

void setMessage(std::string message)

Sets the message that the player will send.

Parameters

NameTypeDescription
messagestd::stringNew message that the player will send

methsetPlayer

void setPlayer(Player& player)

Sets the player that this message will display as.

Parameters

NameTypeDescription
playerPlayer&New player which this event will execute as

methgetFormatconst

std::string getFormat() const

Gets the format to use to display this chat message.

See the format string syntax

Returns

TypeDescription
std::stringformat string

methsetFormat

void setFormat(std::string format)

Sets the format to use to display this chat message.

Parameters

NameTypeDescription
formatstd::stringformat string

methgetRecipientsconst

std::vector<Player*> getRecipients() const

Gets a set of recipients that this chat message will be displayed to.

Returns

TypeDescription
std::vector<Player*>All Players who will see this chat message

classPlayerCommandEvent

Defined in <endstone/event/player/player_command_event.h>

Bases: Cancellable<PlayerEvent>

Called whenever a player runs a command.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerCommandEvent)

methPlayerCommandEventexplicit

PlayerCommandEvent(Player& player, std::string command)

meth~PlayerCommandEvent

~PlayerCommandEvent() override=default

methgetCommandconst

std::string getCommand() const

Gets the command that the player is attempting to send.

Returns

TypeDescription
std::stringCommand the player is attempting to send

methsetCommand

void setCommand(std::string command)

Sets the command that the player will send.

Parameters

NameTypeDescription
commandstd::stringNew command that the player will send

classPlayerDeathEvent

Defined in <endstone/event/actor/player_death_event.h>

Bases: ActorDeathEvent

Called when a Player dies.

Methods

NameDescription
ENDSTONE_EVENT
PlayerDeathEvent
getPlayerReturns the Player involved in this event.
getDeathMessageGet the death message that will appear to everyone on the server.
setDeathMessageSet the death message that will appear to everyone on the server.

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerDeathEvent)

methPlayerDeathEventexplicit

PlayerDeathEvent(Player& player, std::unique_ptr<DamageSource> damage_source, std::optional<Message> death_message)

methgetPlayerconst

Player& getPlayer() const

Returns the Player involved in this event.

Returns

TypeDescription
Player&Player which is involved in this event

methgetDeathMessageconst

std::optional<Message> getDeathMessage() const

Get the death message that will appear to everyone on the server.

Returns

TypeDescription
std::optional<Message>Message to appear to other players on the server.

methsetDeathMessage

void setDeathMessage(std::optional<Message> death_message)

Set the death message that will appear to everyone on the server.

Parameters

NameTypeDescription
death_messagestd::optional<Message>Message to appear to other players on the server.

classPlayerDimensionChangeEvent

Defined in <endstone/event/player/player_dimension_change_event.h>

Bases: PlayerEvent

Called when a player switches to another dimension.

Methods

NameDescription
ENDSTONE_EVENT
PlayerDimensionChangeEvent
getFromGets the dimension the player is switching from.
getToGets the dimension the player is switching to.

methENDSTONE_EVENT

methPlayerDimensionChangeEventexplicit

PlayerDimensionChangeEvent(Player& player, Dimension& from, Dimension& to)

methgetFromconst

Dimension& getFrom() const

Gets the dimension the player is switching from.

Returns

TypeDescription
Dimension&player's previous dimension

methgetToconst

Dimension& getTo() const

Gets the dimension the player is switching to.

Returns

TypeDescription
Dimension&player's new dimension

classPlayerDropItemEvent

Defined in <endstone/event/player/player_drop_item_event.h>

Bases: Cancellable<PlayerEvent>

Called when a player drops an item from their inventory.

Methods

NameDescription
PlayerDropItemEvent
getItemGets the ItemStack dropped by the player.

methPlayerDropItemEventexplicit

PlayerDropItemEvent(Player& player, ItemStack drop)

methgetItemconst

const ItemStack& getItem() const

Gets the ItemStack dropped by the player.

Returns

TypeDescription
const ItemStack&ItemDrop dropped by the player

classPlayerEmoteEvent

Defined in <endstone/event/player/player_emote_event.h>

Bases: Cancellable<PlayerEvent>

Called when a player uses an emote.

Methods

NameDescription
ENDSTONE_EVENT
PlayerEmoteEvent
~PlayerEmoteEvent
getEmoteIdGets the emote piece ID.
isMutedGets the muted state for the emote.
setMutedSets the muted state for the emote.

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerEmoteEvent)

methPlayerEmoteEventexplicit

PlayerEmoteEvent(Player& player, std::string emote_id, bool muted)

meth~PlayerEmoteEvent

~PlayerEmoteEvent() override=default

methgetEmoteIdconst

std::string getEmoteId() const

Gets the emote piece ID.

Returns

TypeDescription
std::stringThe emote piece ID

methisMutedconst

bool isMuted() const

Gets the muted state for the emote.

This method determines whether the emote is being executed without sending a chat message about the emote.

Returns

TypeDescription
booltrue if the emote is muted, false otherwise.

methsetMuted

void setMuted(bool muted)

Sets the muted state for the emote.

Note

If set to true, the emote will be executed silently, and no chat messages will be sent.

Parameters

NameTypeDescription
mutedbooltrue to mute the emote and disable chat messages, false to unmute it.

classPlayerEvent

Defined in <endstone/event/player/player_event.h>

Bases: Event

Represents a player related event.

Variables

NameDescription
player_

Methods

varplayer_protected

methPlayerEventexplicit

PlayerEvent(Player& player)

meth~PlayerEvent

~PlayerEvent() override=default

methgetPlayerconst

Player& getPlayer() const

Returns the player involved in this event

Returns

TypeDescription
Player&Player who is involved in this event

classPlayerGameModeChangeEvent

Defined in <endstone/event/player/player_game_mode_change_event.h>

Bases: Cancellable<PlayerEvent>

Called when the GameMode of the player is changed.

Methods

NameDescription
ENDSTONE_EVENT
PlayerGameModeChangeEvent
~PlayerGameModeChangeEvent
getNewGameModeGets the GameMode the player is switched to.

methENDSTONE_EVENT

methPlayerGameModeChangeEventexplicit

PlayerGameModeChangeEvent(Player& player, GameMode new_game_mode)

meth~PlayerGameModeChangeEvent

~PlayerGameModeChangeEvent() override=default

methgetNewGameModeconst

GameMode getNewGameMode() const

Gets the GameMode the player is switched to.

Returns

TypeDescription
GameModeplayer's new GameMode

classPlayerInteractActorEvent

Defined in <endstone/event/player/player_interact_actor_event.h>

Bases: Cancellable<PlayerEvent>

Represents an event that is called when a player right-clicks an actor.

Methods

NameDescription
ENDSTONE_EVENT
PlayerInteractActorEvent
~PlayerInteractActorEvent
getActorGets the actor that was right-clicked by the player.

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerInteractActorEvent)

methPlayerInteractActorEventexplicit

PlayerInteractActorEvent(Player& player, Actor& actor)

meth~PlayerInteractActorEvent

~PlayerInteractActorEvent() override=default

methgetActorconst

Actor& getActor() const

Gets the actor that was right-clicked by the player.

Returns

TypeDescription
Actor&actor right-clicked by player

classPlayerInteractEvent

Defined in <endstone/event/player/player_interact_event.h>

Bases: Cancellable<PlayerEvent>

Represents an event that is called when a player interacts with an object or air.

Enums

NameDescription
Action

Methods

NameDescription
ENDSTONE_EVENT
PlayerInteractEvent
getActionReturns the action type.
hasItemCheck if this event involved an item.
getItemReturns the item in hand represented by this event.
hasBlockCheck if this event involved a block.
getBlockReturns the clicked block.
getBlockFaceReturns the face of the block that was clicked.
getClickedPositionGets the exact position on the block the player interacted with.

enumAction

Action

Values

NameValueDescription
LeftClickBlockLeft-clicking a block
RightClickBlockRight-clicking a block
LeftClickAirLeft-clicking the air
RightClickAirRight-clicking the air

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerInteractEvent)

methPlayerInteractEvent

PlayerInteractEvent(Player& player, Action action, std::optional<ItemStack> item, Block* block_clicked, BlockFace block_face, std::optional<Vector> clicked_position)

methgetActionconst

Action getAction() const

Returns the action type.

Returns

TypeDescription
ActionAction returns the type of interaction

methhasItemconst

bool hasItem() const

Check if this event involved an item.

Returns

TypeDescription
boolboolean true if it did

methgetItemconst

const std::optional<ItemStack>& getItem() const

Returns the item in hand represented by this event.

Returns

TypeDescription
const std::optional<ItemStack>&ItemStack the item used, or std::nullopt if no item

methhasBlockconst

bool hasBlock() const

Check if this event involved a block.

Returns

TypeDescription
boolboolean true if it did

methgetBlockconst

Block* getBlock() const

Returns the clicked block.

Returns

TypeDescription
Block*Block returns the block clicked with this item.

methgetBlockFaceconst

BlockFace getBlockFace() const

Returns the face of the block that was clicked.

Returns

TypeDescription
BlockFaceBlockFace returns the face of the block that was clicked

methgetClickedPositionconst

std::optional<Vector> getClickedPosition() const

Gets the exact position on the block the player interacted with.

Note

This will be std::nullopt outside of Action.RightClickBlock

Note

All vector components are between 0.0 and 1.0 inclusive.

Returns

TypeDescription
std::optional<Vector>the clicked position.

classPlayerItemConsumeEvent

Defined in <endstone/event/player/player_item_consume_event.h>

Bases: Cancellable<PlayerEvent>

Called when a player is finishing consuming an item (food, potion, milk bucket).

Note

If the ItemStack is modified the server will use the effects of the new item and not remove the original one from the player's inventory.

Note

If the event is cancelled the effect will not be applied and the item will not be removed from the player's inventory.

Methods

NameDescription
PlayerItemConsumeEvent
getItemGets the item that is being consumed.
getHandGet the hand used to consume the item.

methPlayerItemConsumeEventexplicit

PlayerItemConsumeEvent(Player& player, ItemStack item, EquipmentSlot hand)

methgetItemconst

const ItemStack& getItem() const

Gets the item that is being consumed.

Returns

TypeDescription
const ItemStack&an ItemStack for the item being consumed

methgetHandconst

EquipmentSlot getHand() const

Get the hand used to consume the item.

Returns

TypeDescription
EquipmentSlotthe hand

classPlayerItemHeldEvent

Defined in <endstone/event/player/player_item_held_event.h>

Bases: Cancellable<PlayerEvent>

Called when a player changes their currently held item.

Methods

NameDescription
PlayerItemHeldEvent
getPreviousSlotGets the previous held slot index.
getNewSlotGets the new held slot index.

methPlayerItemHeldEventexplicit

PlayerItemHeldEvent(Player& player, const int previous, const int current)

methgetPreviousSlotconst

int getPreviousSlot() const

Gets the previous held slot index.

Returns

TypeDescription
intPrevious slot index

methgetNewSlotconst

int getNewSlot() const

Gets the new held slot index.

Returns

TypeDescription
intNew slot index

classPlayerJoinEvent

Defined in <endstone/event/player/player_join_event.h>

Bases: PlayerEvent

Called when a player joins a server.

Methods

NameDescription
ENDSTONE_EVENT
PlayerJoinEvent
getJoinMessageGets the join message to send to all online players.
setJoinMessageSets the join message to send to all online players.

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerJoinEvent)

methPlayerJoinEventexplicit

PlayerJoinEvent(Player& player, std::optional<Message> join_message)

methgetJoinMessageconst

std::optional<Message> getJoinMessage() const

Gets the join message to send to all online players.

Returns

TypeDescription
std::optional<Message>Message to appear to other players on the server.

methsetJoinMessage

void setJoinMessage(std::optional<Message> message)

Sets the join message to send to all online players.

Parameters

NameTypeDescription
messagestd::optional<Message>Message to appear to other players on the server.

classPlayerJumpEvent

Defined in <endstone/event/player/player_jump_event.h>

Bases: PlayerMoveEvent

Called when a player jumps.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerJumpEvent)

methPlayerMoveEventexplicit

PlayerMoveEvent(Player& player, Location from, Location to)

classPlayerKickEvent

Defined in <endstone/event/player/player_kick_event.h>

Bases: Cancellable<PlayerEvent>

Called when a player gets kicked from the server.

Methods

NameDescription
ENDSTONE_EVENT
PlayerKickEvent
getReasonGets the reason why the player is getting kicked.
setReasonSets the reason why the player is getting kicked.

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerKickEvent)

methPlayerKickEventexplicit

PlayerKickEvent(Player& player, std::string reason)

methgetReasonconst

std::string getReason() const

Gets the reason why the player is getting kicked.

Returns

TypeDescription
std::stringstring kick reason

methsetReason

void setReason(std::string reason)

Sets the reason why the player is getting kicked.

Parameters

NameTypeDescription
reasonstd::stringkick reason

classPlayerLoginEvent

Defined in <endstone/event/player/player_login_event.h>

Bases: Cancellable<PlayerEvent>

Called when a player attempts to login in.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerLoginEvent)

methPlayerLoginEventexplicit

PlayerLoginEvent(Player& player, std::string message = "")

meth~PlayerLoginEvent

~PlayerLoginEvent() override=default

methgetKickMessageconst

const std::string& getKickMessage() const

Gets the current kick message that will be used if event is cancelled

Returns

TypeDescription
const std::string&Current kick message

methsetKickMessage

void setKickMessage(const std::string& message)

Sets the kick message to display if event is cancelled

Parameters

NameTypeDescription
messageconst std::string&New kick message

classPlayerMoveEvent

Defined in <endstone/event/player/player_move_event.h>

Bases: Cancellable<PlayerEvent>

Called when a player moves.

Variables

NameDescription
from_
to_

Methods

NameDescription
ENDSTONE_EVENT
PlayerMoveEvent
getFromGets the location this player moved from.
setFromSets the location to mark as where the player moved from.
getToGets the location this player moved to.
setToSets the location that this player will move to.

varfrom_

Location from_

varto_

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerMoveEvent)

methPlayerMoveEventexplicit

PlayerMoveEvent(Player& player, Location from, Location to)

methgetFromconst

const Location& getFrom() const

Gets the location this player moved from.

Returns

TypeDescription
const Location&Location the player moved from

methsetFrom

void setFrom(const Location& from)

Sets the location to mark as where the player moved from.

Parameters

NameTypeDescription
fromconst Location&New location to mark as the players previous location

methgetToconst

const Location& getTo() const

Gets the location this player moved to.

Returns

TypeDescription
const Location&Location the player moved to

methsetTo

void setTo(const Location& to)

Sets the location that this player will move to.

Parameters

NameTypeDescription
toconst Location&New Location this player will move to

classPlayerPickupItemEvent

Defined in <endstone/event/player/player_pickup_item_event.h>

Bases: Cancellable<PlayerEvent>

Called when a player picks an item up from the ground.

Methods

NameDescription
ENDSTONE_EVENT
PlayerPickupItemEvent
getItemGets the Item picked up by the entity.

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerPickupItemEvent)

methPlayerPickupItemEventexplicit

PlayerPickupItemEvent(Player& player, Item& item)

methgetItemconst

Item& getItem() const

Gets the Item picked up by the entity.

Returns

TypeDescription
Item&Item

classPlayerPortalEvent

Defined in <endstone/event/player/player_portal_event.h>

Bases: PlayerTeleportEvent

Called when a player is about to teleport because it is in contact with a portal.

Methods

NameDescription
ENDSTONE_EVENT

classPlayerQuitEvent

Defined in <endstone/event/player/player_quit_event.h>

Bases: PlayerEvent

Called when a player leaves a server.

Methods

NameDescription
ENDSTONE_EVENT
PlayerQuitEvent
getQuitMessageGets the quit message to send to all online players.
setQuitMessageSets the quit message to send to all online players.

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerQuitEvent)

methPlayerQuitEventexplicit

PlayerQuitEvent(Player& player, std::optional<Message> quit_message)

methgetQuitMessageconst

std::optional<Message> getQuitMessage() const

Gets the quit message to send to all online players.

Returns

TypeDescription
std::optional<Message>Message to appear to other players on the server.

methsetQuitMessage

void setQuitMessage(std::optional<Message> message)

Sets the quit message to send to all online players.

Parameters

NameTypeDescription
messagestd::optional<Message>Message to appear to other players on the server.

classPlayerRespawnEvent

Defined in <endstone/event/player/player_respawn_event.h>

Bases: PlayerEvent

Called when a player respawns.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerRespawnEvent)

methPlayerRespawnEventexplicit

PlayerRespawnEvent(Player& player)

meth~PlayerRespawnEvent

~PlayerRespawnEvent() override=default

classPlayerSkinChangeEvent

Defined in <endstone/event/player/player_skin_change_event.h>

Bases: Cancellable<PlayerEvent>

Called when a player changes their skin.

Methods

NameDescription
ENDSTONE_EVENT
PlayerSkinChangeEvent
getNewSkinGets the player's new skin.
getSkinChangeMessageGets the message to send to all online players for this skin change.
setSkinChangeMessageSets the message to send to all online players for this skin change.

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerSkinChangeEvent)

methPlayerSkinChangeEventexplicit

PlayerSkinChangeEvent(Player& player, Skin new_skin, std::optional<Message> message)

methgetNewSkinconst

Skin getNewSkin() const

Gets the player's new skin.

Returns

TypeDescription
SkinThe skin that will be applied.

methgetSkinChangeMessageconst

std::optional<Message> getSkinChangeMessage() const

Gets the message to send to all online players for this skin change.

Returns

TypeDescription
std::optional<Message>Message to appear to other players on the server.

methsetSkinChangeMessage

void setSkinChangeMessage(std::optional<Message> message)

Sets the message to send to all online players for this skin change.

Parameters

NameTypeDescription
messagestd::optional<Message>Message to appear to other players on the server.

classPlayerTeleportEvent

Defined in <endstone/event/player/player_teleport_event.h>

Bases: PlayerMoveEvent

Called when a player is teleported from one location to another.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(PlayerTeleportEvent)

methPlayerMoveEventexplicit

PlayerMoveEvent(Player& player, Location from, Location to)

classPluginDisableEvent

Defined in <endstone/event/server/plugin_disable_event.h>

Bases: ServerEvent

Called when a plugin is disabled.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(PluginDisableEvent)

methPluginDisableEventexplicit

PluginDisableEvent(Plugin& plugin)

methgetPluginconst

Plugin& getPlugin() const

Gets the plugin involved in this event

Returns

TypeDescription
Plugin&Plugin for this event

classPluginEnableEvent

Defined in <endstone/event/server/plugin_enable_event.h>

Bases: ServerEvent

Called when a plugin is enabled.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(PluginEnableEvent)

methPluginEnableEventexplicit

PluginEnableEvent(Plugin& plugin)

methgetPluginconst

Plugin& getPlugin() const

Gets the plugin involved in this event

Returns

TypeDescription
Plugin&Plugin for this event

classScriptMessageEvent

Defined in <endstone/event/server/script_message_event.h>

Bases: Cancellable<ServerEvent>

Called when a message is sent by /scriptevent command.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(ScriptMessageEvent)

methScriptMessageEvent

ScriptMessageEvent(std::string message_id, std::string message, const CommandSender& sender)

methgetMessageIdconst

const std::string& getMessageId() const

Get the message id to send.

Returns

TypeDescription
const std::string&Message id to send

methgetMessageconst

const std::string& getMessage() const

Get the message to send.

Returns

TypeDescription
const std::string&Message to send

methgetSenderconst

const CommandSender& getSender() const

Gets the command sender who initiated the command

Returns

TypeDescription
const CommandSender&Command sender who initiated the command

classServerCommandEvent

Defined in <endstone/event/server/server_command_event.h>

Bases: Cancellable<ServerEvent>

Called when the console runs a command, early in the process.

You should not use this except for a few cases like logging commands, blocking commands on certain places, or applying modifiers.

The command message contains a slash '/' at the start

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(ServerCommandEvent)

methServerCommandEvent

ServerCommandEvent(CommandSender& sender, std::string command)

methgetCommandconst

std::string getCommand() const

Gets the command that the server is attempting to execute from the console

Returns

TypeDescription
std::stringCommand the server is attempting to execute

methsetCommand

void setCommand(std::string message)

Sets the command that the server will execute

Parameters

NameTypeDescription
messagestd::stringNew message that the server will execute

methgetSenderconst

CommandSender& getSender() const

Get the command sender.

Returns

TypeDescription
CommandSender&The sender

classServerEvent

Defined in <endstone/event/server/server_event.h>

Bases: Event

Represents a Server-related event.

Methods

NameDescription
Event
Event
Event

methEventexplicit

Event(bool async = false)

methEvent

Event(const Event&) =delete

methEvent

Event(Event&&) =default

classServerListPingEvent

Defined in <endstone/event/server/server_list_ping_event.h>

Bases: Cancellable<ServerEvent>

Called when a server ping is coming in.

Methods

NameDescription
ENDSTONE_EVENT
ServerListPingEvent
getAddressGet the address the ping is coming from.
getServerGuidGet the unique identifier of the server.
setServerGuidSet the unique identifier of the server.
getLocalPortGet the local port of the server.
setLocalPortSet the local port of the server.
getLocalPortV6Get the local port of the server for IPv6 support.
setLocalPortV6Set the local port of the server for IPv6 support.
getMotdGet the message of the day message.
setMotdChange the message of the day message.
getNetworkProtocolVersionGet the network protocol version of this server.
getMinecraftVersionNetworkGet the network version of Minecraft that is supported by this server.
setMinecraftVersionNetworkSet the network version of Minecraft that is supported by this server.
getNumPlayersGet the number of players online.
setNumPlayersSet the number of players online.
getMaxPlayersGet the maximum number of players allowed.
setMaxPlayersSet the maximum number of players allowed.
getLevelNameGet the level name.
setLevelNameSet the level name.
getGameModeGet the current game mode.
setGameModeSet the current game mode.

methENDSTONE_EVENT

ENDSTONE_EVENT(ServerListPingEvent)

methServerListPingEvent

ServerListPingEvent(SocketAddress address, std::string motd, int network_protocol_version, std::string minecraft_version_network, int num_players, int max_players, std::string server_guid, std::string level_name, GameMode game_mode, int local_port, int local_port_v6)

methgetAddressconst

SocketAddress getAddress() const

Get the address the ping is coming from.

Returns

TypeDescription
SocketAddressthe address

methgetServerGuidconst

std::string getServerGuid() const

Get the unique identifier of the server.

Returns

TypeDescription
std::stringThe server guid

methsetServerGuid

void setServerGuid(std::string guid)

Set the unique identifier of the server.

Parameters

NameTypeDescription
guidstd::stringthe server guid

methgetLocalPortconst

int getLocalPort() const

Get the local port of the server.

Returns

TypeDescription
intThe local port

methsetLocalPort

void setLocalPort(int port)

Set the local port of the server.

Parameters

NameTypeDescription
portintthe local port

methgetLocalPortV6const

int getLocalPortV6() const

Get the local port of the server for IPv6 support.

Returns

TypeDescription
intThe local port for IPv6

methsetLocalPortV6

void setLocalPortV6(int port)

Set the local port of the server for IPv6 support.

Parameters

NameTypeDescription
portintthe local port for IPv6

methgetMotdconst

std::string getMotd() const

Get the message of the day message.

Returns

TypeDescription
std::stringthe message of the day

methsetMotd

void setMotd(std::string motd)

Change the message of the day message.

Parameters

NameTypeDescription
motdstd::stringthe message of the day

methgetNetworkProtocolVersionconst

int getNetworkProtocolVersion() const

Get the network protocol version of this server.

Returns

TypeDescription
intthe network protocol version

methgetMinecraftVersionNetworkconst

std::string getMinecraftVersionNetwork() const

Get the network version of Minecraft that is supported by this server.

Returns

TypeDescription
std::stringthe network version of Minecraft

methsetMinecraftVersionNetwork

void setMinecraftVersionNetwork(std::string minecraft_version_network)

Set the network version of Minecraft that is supported by this server.

Parameters

NameTypeDescription
minecraft_version_networkstd::stringthe network version of Minecraft

methgetNumPlayersconst

int getNumPlayers() const

Get the number of players online.

Returns

TypeDescription
intthe number of players

methsetNumPlayers

void setNumPlayers(int num_players)

Set the number of players online.

Parameters

NameTypeDescription
num_playersintthe number of players

methgetMaxPlayersconst

int getMaxPlayers() const

Get the maximum number of players allowed.

Returns

TypeDescription
intthe maximum number of players

methsetMaxPlayers

void setMaxPlayers(int max_players)

Set the maximum number of players allowed.

Parameters

NameTypeDescription
max_playersintthe maximum number of players

methgetLevelNameconst

std::string getLevelName() const

Get the level name.

Returns

TypeDescription
std::stringthe level name

methsetLevelName

void setLevelName(std::string level_name)

Set the level name.

Parameters

NameTypeDescription
level_namestd::stringthe level name

methgetGameModeconst

GameMode getGameMode() const

Get the current game mode.

Returns

TypeDescription
GameModethe game mode

methsetGameMode

void setGameMode(GameMode game_mode)

Set the current game mode.

Parameters

NameTypeDescription
game_modeGameModethe game mode

classServerLoadEvent

Defined in <endstone/event/server/server_load_event.h>

Bases: ServerEvent

Called when either the server startup or reload has completed.

Enums

NameDescription
LoadType

Methods

enumLoadType

LoadType

Values

NameValueDescription
Startup
Reload

methENDSTONE_EVENT

ENDSTONE_EVENT(ServerLoadEvent)

methServerLoadEventexplicit

ServerLoadEvent(LoadType type)

methgetTypeconst

LoadType getType() const

classThunderChangeEvent

Defined in <endstone/event/weather/thunder_change_event.h>

Bases: Cancellable<WeatherEvent>

Called when the thunder state in a world is changing.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(ThunderChangeEvent)

methThunderChangeEvent

ThunderChangeEvent(Level& level, bool to)

meth~ThunderChangeEvent

~ThunderChangeEvent() override=default

methtoThunderStateconst

bool toThunderState() const

Gets the state of thunder that the world is being set to

Returns

TypeDescription
booltrue if the weather is being set to thundering, false otherwise

classWeatherChangeEvent

Defined in <endstone/event/weather/weather_change_event.h>

Bases: Cancellable<WeatherEvent>

Called when the weather (rain) state in a world is changing.

Methods

methENDSTONE_EVENT

ENDSTONE_EVENT(WeatherChangeEvent)

methWeatherChangeEvent

WeatherChangeEvent(Level& level, const bool to)

meth~WeatherChangeEvent

~WeatherChangeEvent() override=default

methtoWeatherStateconst

bool toWeatherState() const

Gets the state of weather that the world is being set to

Returns

TypeDescription
booltrue if the weather is being set to raining, false otherwise

classWeatherEvent

Defined in <endstone/event/weather/weather_event.h>

Bases: Event

Represents a Weather-related event.

Methods

methWeatherEventexplicit

WeatherEvent(Level& level)

meth~WeatherEvent

~WeatherEvent() override=default

methgetLevelconst

Level& getLevel() const

Returns the Level where this event is occurring

Returns

TypeDescription
Level&Level this event is occurring in

enumEventPriority

EventPriority

Represents an event's priority in execution.

Listeners with lower priority are called first will listeners with higher priority are called last. Listeners are called in following order: LOWEST -> LOW -> NORMAL -> HIGH -> HIGHEST -> MONITOR

Values

NameValueDescription
Lowest0Event call is of very low importance and should be run first, to allow other plugins to further customise the outcome
Low1Event call is of low importance
Normal2Event call is neither important nor unimportant, and may be run normally
High3Event call is of high importance
Highest4Event call is critical and must have the final say in what happens to the event
Monitor5Event is listened to purely for monitoring the outcome of an event. No modifications to the event should be made under this priority

enumEventResult

EventResult

Values

NameValueDescription
DenyDeny the event.
DefaultNeither deny nor allow the event. The server will proceed with its normal handling.
AllowAllow / Force the event.

On this page

classActorDamageEventmethENDSTONE_EVENTmethActorDamageEventmethgetDamagemethsetDamagemethgetDamageSourceclassActorDeathEventmethENDSTONE_EVENTmethActorDeathEventmethgetDamageSourceclassActorEventmethActorEventmeth~ActorEventmethgetActorclassActorExplodeEventmethENDSTONE_EVENTmethActorExplodeEventmeth~ActorExplodeEventmethgetLocationmethgetBlockListmethgetBlockListclassActorKnockbackEventmethENDSTONE_EVENTmethActorKnockbackEventmethgetSourcemethgetKnockbackmethsetKnockbackclassActorRemoveEventmethENDSTONE_EVENTmethActorEventclassActorSpawnEventmethENDSTONE_EVENTmethActorSpawnEventmeth~ActorSpawnEventclassActorTeleportEventmethENDSTONE_EVENTmethActorTeleportEventmeth~ActorTeleportEventmethgetFrommethsetFrommethgetTomethsetToclassBlockBreakEventmethENDSTONE_EVENTmethBlockBreakEventmeth~BlockBreakEventmethgetPlayerclassBlockCookEventmethENDSTONE_EVENTmethBlockCookEventmethgetSourcemethgetResultmethsetResultclassBlockEventvarblock_methBlockEventmethgetBlockclassBlockExplodeEventmethENDSTONE_EVENTmethBlockExplodeEventmeth~BlockExplodeEventmethgetBlockListmethgetBlockListclassBlockFormEventmethENDSTONE_EVENTmethBlockGrowEventclassBlockFromToEventvarto_methENDSTONE_EVENTmethBlockFromToEventmethgetToBlockclassBlockGrowEventmethENDSTONE_EVENTmethBlockGrowEventmethgetNewStateclassBlockPistonEventmethBlockPistonEventmethgetDirectionclassBlockPistonExtendEventmethENDSTONE_EVENTmethBlockPistonEventclassBlockPistonRetractEventmethENDSTONE_EVENTmethBlockPistonEventclassBlockPlaceEventmethENDSTONE_EVENTmethBlockPlaceEventmeth~BlockPlaceEventmethgetPlayermethgetBlockPlacedStatemethgetBlockReplacedmethgetBlockAgainstclassBroadcastMessageEventmethENDSTONE_EVENTmethBroadcastMessageEventmethgetMessagemethsetMessagemethgetRecipientsclassCancellablemethisCancelledmethsetCancelledmethcancelclassChunkEventmethChunkEventmethgetChunkclassChunkLoadEventmethENDSTONE_EVENTmethChunkLoadEventmeth~ChunkLoadEventclassChunkUnloadEventmethENDSTONE_EVENTmethChunkUnloadEventmeth~ChunkUnloadEventclassDimensionEventmethDimensionEventmethgetDimensionclassEventmethEventmethEventmethoperator=methEventmethoperator=meth~EventmethgetEventNamemethisAsynchronousclassEventHandlermethEventHandlermethgetPluginmethgetPrioritymethisIgnoreCancelledmethcallEventmethgetEventTypeclassHandlerListmethHandlerListmethregisterHandlermethunregistermethunregistermethgetHandlersmethbakeclassICancellablemeth~ICancellablemethisCancelledmethsetCancelledmethcancelclassLeavesDecayEventmethENDSTONE_EVENTclassLevelEventmethLevelEventmethgetLevelclassMapInitializeEventmethMapInitializeEventmethgetMapclassPacketReceiveEventmethENDSTONE_EVENTmethPacketReceiveEventmethgetPacketIdmethgetPayloadmethsetPayloadmethgetPlayermethgetAddressmethgetSubClientIdclassPacketSendEventmethENDSTONE_EVENTmethPacketSendEventmethgetPacketIdmethgetPayloadmethsetPayloadmethgetPlayermethgetAddressmethgetSubClientIdclassPlayerBedEnterEventmethPlayerBedEnterEventmethgetBedclassPlayerBedLeaveEventmethPlayerBedLeaveEventmeth~PlayerBedLeaveEventmethgetBedclassPlayerChatEventmethENDSTONE_EVENTmethPlayerChatEventmethgetMessagemethsetMessagemethsetPlayermethgetFormatmethsetFormatmethgetRecipientsclassPlayerCommandEventmethENDSTONE_EVENTmethPlayerCommandEventmeth~PlayerCommandEventmethgetCommandmethsetCommandclassPlayerDeathEventmethENDSTONE_EVENTmethPlayerDeathEventmethgetPlayermethgetDeathMessagemethsetDeathMessageclassPlayerDimensionChangeEventmethENDSTONE_EVENTmethPlayerDimensionChangeEventmethgetFrommethgetToclassPlayerDropItemEventmethPlayerDropItemEventmethgetItemclassPlayerEmoteEventmethENDSTONE_EVENTmethPlayerEmoteEventmeth~PlayerEmoteEventmethgetEmoteIdmethisMutedmethsetMutedclassPlayerEventvarplayer_methPlayerEventmeth~PlayerEventmethgetPlayerclassPlayerGameModeChangeEventmethENDSTONE_EVENTmethPlayerGameModeChangeEventmeth~PlayerGameModeChangeEventmethgetNewGameModeclassPlayerInteractActorEventmethENDSTONE_EVENTmethPlayerInteractActorEventmeth~PlayerInteractActorEventmethgetActorclassPlayerInteractEventenumActionmethENDSTONE_EVENTmethPlayerInteractEventmethgetActionmethhasItemmethgetItemmethhasBlockmethgetBlockmethgetBlockFacemethgetClickedPositionclassPlayerItemConsumeEventmethPlayerItemConsumeEventmethgetItemmethgetHandclassPlayerItemHeldEventmethPlayerItemHeldEventmethgetPreviousSlotmethgetNewSlotclassPlayerJoinEventmethENDSTONE_EVENTmethPlayerJoinEventmethgetJoinMessagemethsetJoinMessageclassPlayerJumpEventmethENDSTONE_EVENTmethPlayerMoveEventclassPlayerKickEventmethENDSTONE_EVENTmethPlayerKickEventmethgetReasonmethsetReasonclassPlayerLoginEventmethENDSTONE_EVENTmethPlayerLoginEventmeth~PlayerLoginEventmethgetKickMessagemethsetKickMessageclassPlayerMoveEventvarfrom_varto_methENDSTONE_EVENTmethPlayerMoveEventmethgetFrommethsetFrommethgetTomethsetToclassPlayerPickupItemEventmethENDSTONE_EVENTmethPlayerPickupItemEventmethgetItemclassPlayerPortalEventmethENDSTONE_EVENTclassPlayerQuitEventmethENDSTONE_EVENTmethPlayerQuitEventmethgetQuitMessagemethsetQuitMessageclassPlayerRespawnEventmethENDSTONE_EVENTmethPlayerRespawnEventmeth~PlayerRespawnEventclassPlayerSkinChangeEventmethENDSTONE_EVENTmethPlayerSkinChangeEventmethgetNewSkinmethgetSkinChangeMessagemethsetSkinChangeMessageclassPlayerTeleportEventmethENDSTONE_EVENTmethPlayerMoveEventclassPluginDisableEventmethENDSTONE_EVENTmethPluginDisableEventmethgetPluginclassPluginEnableEventmethENDSTONE_EVENTmethPluginEnableEventmethgetPluginclassScriptMessageEventmethENDSTONE_EVENTmethScriptMessageEventmethgetMessageIdmethgetMessagemethgetSenderclassServerCommandEventmethENDSTONE_EVENTmethServerCommandEventmethgetCommandmethsetCommandmethgetSenderclassServerEventmethEventmethEventmethEventclassServerListPingEventmethENDSTONE_EVENTmethServerListPingEventmethgetAddressmethgetServerGuidmethsetServerGuidmethgetLocalPortmethsetLocalPortmethgetLocalPortV6methsetLocalPortV6methgetMotdmethsetMotdmethgetNetworkProtocolVersionmethgetMinecraftVersionNetworkmethsetMinecraftVersionNetworkmethgetNumPlayersmethsetNumPlayersmethgetMaxPlayersmethsetMaxPlayersmethgetLevelNamemethsetLevelNamemethgetGameModemethsetGameModeclassServerLoadEventenumLoadTypemethENDSTONE_EVENTmethServerLoadEventmethgetTypeclassThunderChangeEventmethENDSTONE_EVENTmethThunderChangeEventmeth~ThunderChangeEventmethtoThunderStateclassWeatherChangeEventmethENDSTONE_EVENTmethWeatherChangeEventmeth~WeatherChangeEventmethtoWeatherStateclassWeatherEventmethWeatherEventmeth~WeatherEventmethgetLevelenumEventPriorityenumEventResult