endstone/event
Classes
| Name | Description |
|---|---|
ActorDamageEvent | Called when an Actor is damaged. |
ActorDeathEvent | Called when an Actor dies. |
ActorEvent | Represents an Actor-related event. |
ActorExplodeEvent | Called when an actor explodes. |
ActorKnockbackEvent | Called when a living entity receives knockback. |
ActorRemoveEvent | Called when an Actor is removed. |
ActorSpawnEvent | Called when an Actor is spawned into a world. |
ActorTeleportEvent | Called when a non-player entity is teleported from one location to another. |
BlockBreakEvent | Called when a block is broken by a player. |
BlockCookEvent | Called when an ItemStack is successfully cooked in a block. |
BlockEvent | Represents an Block-related event. |
BlockExplodeEvent | Called when a block explodes (e.g. bed in the Nether, respawn anchor in the Overworld). |
BlockFormEvent | Called when a block is formed or spreads based on world conditions. |
BlockFromToEvent | Represents events with a source block and a destination block, currently only applies to liquid (lava and water) and teleporting dragon eggs. |
BlockGrowEvent | Called when a block grows naturally in the world. |
BlockPistonEvent | Called when a piston block is triggered. |
BlockPistonExtendEvent | Called when a piston extends. |
BlockPistonRetractEvent | Called when a piston retracts. |
BlockPlaceEvent | Called when a block is placed by a player. |
BroadcastMessageEvent | Event triggered for server broadcast messages such as from Server::broadcast. |
Cancellable | A type characterizing events that may be cancelled by a plugin or the server. |
ChunkEvent | Represents a Chunk related event. |
ChunkLoadEvent | Called when a chunk is loaded. |
ChunkUnloadEvent | Called when a chunk is unloaded. |
DimensionEvent | Represents events within a level. |
Event | Represents an event. |
EventHandler | Represents a registered EventHandler which associates with a Plugin. |
HandlerList | A list of event handlers. Should be instantiated on a per-event basis. |
ICancellable | |
LeavesDecayEvent | Called when leaves are decaying naturally. |
LevelEvent | Represents events within a level. |
MapInitializeEvent | Called when a map is initialized. |
PacketReceiveEvent | Called when the server receives a packet from a connected client. |
PacketSendEvent | Called when the server sends a packet to a connected client. |
PlayerBedEnterEvent | Called when a player is almost about to enter the bed. |
PlayerBedLeaveEvent | Called when a player is leaving a bed. |
PlayerChatEvent | Called when a player sends a chat message. |
PlayerCommandEvent | Called whenever a player runs a command. |
PlayerDeathEvent | Called when a Player dies. |
PlayerDimensionChangeEvent | Called when a player switches to another dimension. |
PlayerDropItemEvent | Called when a player drops an item from their inventory. |
PlayerEmoteEvent | Called when a player uses an emote. |
PlayerEvent | Represents a player related event. |
PlayerGameModeChangeEvent | Called when the GameMode of the player is changed. |
PlayerInteractActorEvent | Represents an event that is called when a player right-clicks an actor. |
PlayerInteractEvent | Represents an event that is called when a player interacts with an object or air. |
PlayerItemConsumeEvent | Called when a player is finishing consuming an item (food, potion, milk bucket). |
PlayerItemHeldEvent | Called when a player changes their currently held item. |
PlayerJoinEvent | Called when a player joins a server. |
PlayerJumpEvent | Called when a player jumps. |
PlayerKickEvent | Called when a player gets kicked from the server. |
PlayerLoginEvent | Called when a player attempts to login in. |
PlayerMoveEvent | Called when a player moves. |
PlayerPickupItemEvent | Called when a player picks an item up from the ground. |
PlayerPortalEvent | Called when a player is about to teleport because it is in contact with a portal. |
PlayerQuitEvent | Called when a player leaves a server. |
PlayerRespawnEvent | Called when a player respawns. |
PlayerSkinChangeEvent | Called when a player changes their skin. |
PlayerTeleportEvent | Called when a player is teleported from one location to another. |
PluginDisableEvent | Called when a plugin is disabled. |
PluginEnableEvent | Called when a plugin is enabled. |
ScriptMessageEvent | Called when a message is sent by /scriptevent command. |
ServerCommandEvent | Called when the console runs a command, early in the process. |
ServerEvent | Represents a Server-related event. |
ServerListPingEvent | Called when a server ping is coming in. |
ServerLoadEvent | Called when either the server startup or reload has completed. |
ThunderChangeEvent | Called when the thunder state in a world is changing. |
WeatherChangeEvent | Called when the weather (rain) state in a world is changing. |
WeatherEvent | Represents a Weather-related event. |
Enums
| Name | Description |
|---|---|
EventPriority | Represents 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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
ActorDamageEvent | |
getDamage | Gets the raw amount of damage caused by the event. |
setDamage | Sets the raw amount of damage caused by the event. |
getDamageSource | Get 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() constGets the raw amount of damage caused by the event.
Returns
| Type | Description |
|---|---|
float | The 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
| Name | Type | Description |
|---|---|---|
damage | const float | The raw amount of damage caused by the event |
methgetDamageSourceconst
DamageSource& getDamageSource() constGet the source of damage.
Returns
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
ActorDeathEvent | |
getDamageSource | Gets 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() constGets the source of damage which caused the death.
Returns
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
ActorEvent | |
~ActorEvent | |
getActor | Returns the Actor involved in this event. |
methActorEventexplicit
ActorEvent(ActorType& actor)meth~ActorEvent
~ActorEvent() override=defaultmethgetActorconst
ActorType& getActor() constReturns the Actor involved in this event.
Returns
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
ActorExplodeEvent | |
~ActorExplodeEvent | |
getLocation | Returns the location where the explosion happened. |
getBlockList | Returns the list of blocks that would have been removed or were removed from the explosion event. |
getBlockList | Returns the list of blocks that would have been removed or were removed from the explosion event. |
methENDSTONE_EVENT
ENDSTONE_EVENT(ActorExplodeEvent)methActorExplodeEventexplicit
meth~ActorExplodeEvent
~ActorExplodeEvent() override=defaultmethgetLocationconst
const Location& getLocation() constReturns 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
| Type | Description |
|---|---|
const Location& | The location of the explosion |
methgetBlockListconst
const BlockList& getBlockList() constReturns the list of blocks that would have been removed or were removed from the explosion event.
Returns
| Type | Description |
|---|---|
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
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
ActorKnockbackEvent | |
getSource | Get the source actor that has caused knockback to the defender, if exists. |
getKnockback | |
setKnockback | Sets the knockback that will be applied to the entity. |
methENDSTONE_EVENT
ENDSTONE_EVENT(ActorKnockbackEvent)methActorKnockbackEventexplicit
methgetSourceconst
Actor* getSource() constGet the source actor that has caused knockback to the defender, if exists.
Returns
| Type | Description |
|---|---|
Actor* | actor that caused knockback, or nullptr if the knockback is not caused by an actor. |
methgetKnockbackconst
Vector getKnockback() constGets the knockback that will be applied to the entity.
Note: this method returns a copy, changes must be applied with setKnockback(Vector)
Returns
| Type | Description |
|---|---|
Vector | the knockback |
methsetKnockback
void setKnockback(Vector knockback)Sets the knockback that will be applied to the entity.
Parameters
| Name | Type | Description |
|---|---|---|
knockback | Vector | the 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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
ActorEvent |
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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
ActorSpawnEvent | |
~ActorSpawnEvent |
methENDSTONE_EVENT
ENDSTONE_EVENT(ActorSpawnEvent)methActorSpawnEventexplicit
ActorSpawnEvent(Actor& actor)meth~ActorSpawnEvent
~ActorSpawnEvent() override=defaultclassActorTeleportEvent
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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
ActorTeleportEvent | |
~ActorTeleportEvent | |
getFrom | Gets the location that this actor moved from. |
setFrom | Sets the location that this actor moved from. |
getTo | Gets the location that this actor moved to. |
setTo | Sets the location that this actor moved to. |
methENDSTONE_EVENT
ENDSTONE_EVENT(ActorTeleportEvent)methActorTeleportEventexplicit
meth~ActorTeleportEvent
~ActorTeleportEvent() override=defaultmethgetFromconst
const Location& getFrom() constGets the location that this actor moved from.
methsetFrom
void setFrom(const Location& from)Sets the location that this actor moved from.
Parameters
| Name | Type | Description |
|---|---|---|
from | const Location& | New location this actor moved from |
methgetToconst
const Location& getTo() constGets the location that this actor moved to.
methsetTo
void setTo(const Location& to)Sets the location that 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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
BlockBreakEvent | |
~BlockBreakEvent | |
getPlayer | Gets 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=defaultmethgetPlayerconst
Player& getPlayer() constGets 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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
BlockCookEvent | |
getSource | Gets the smelted ItemStack for this event. |
getResult | Gets the resultant ItemStack for this event. |
setResult | Sets 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() constGets the smelted ItemStack for this event.
methgetResultconst
const ItemStack& getResult() constGets the resultant ItemStack for this event.
methsetResult
void setResult(ItemStack result)Sets the resultant ItemStack for this event.
classBlockEvent
Defined in <endstone/event/block/block_event.h>
Bases: Event
Represents an Block-related event.
Variables
| Name | Description |
|---|---|
block_ |
Methods
| Name | Description |
|---|---|
BlockEvent | |
getBlock | Gets the block involved in this event. |
varblock_protected
std::unique_ptr<Block> block_methBlockEventexplicit
BlockEvent(std::unique_ptr<Block> block)methgetBlockconst
Block& getBlock() constGets the block 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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
BlockExplodeEvent | |
~BlockExplodeEvent | |
getBlockList | Returns the list of blocks that would have been removed or were removed from the explosion event. |
getBlockList | Returns 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=defaultmethgetBlockListconst
const BlockList& getBlockList() constReturns the list of blocks that would have been removed or were removed from the explosion event.
Returns
| Type | Description |
|---|---|
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
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
BlockGrowEvent |
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
| Name | Description |
|---|---|
to_ |
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
BlockFromToEvent | |
getToBlock | Convenience method for getting the faced Block. |
varto_protected
std::unique_ptr<Block> to_methENDSTONE_EVENT
ENDSTONE_EVENT(BlockFromToEvent)methBlockFromToEventexplicit
BlockFromToEvent(std::unique_ptr<Block> block, std::unique_ptr<Block> to_block)methgetToBlockconst
Block& getToBlock() constConvenience method for getting 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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
BlockGrowEvent | |
getNewState | Gets 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() constGets the state of the block where it will form or spread to.
Returns
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
BlockPistonEvent | |
getDirection | Return the direction in which the piston will operate. |
methBlockPistonEventexplicit
BlockPistonEvent(std::unique_ptr<Block> block, BlockFace direction)methgetDirectionconst
BlockFace getDirection() constReturn the direction in which the piston will operate.
Returns
| Type | Description |
|---|---|
BlockFace | direction of the piston |
classBlockPistonExtendEvent
Defined in <endstone/event/block/block_piston_extend_event.h>
Bases: BlockPistonEvent
Called when a piston extends.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
BlockPistonEvent |
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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
BlockPistonEvent |
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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
BlockPlaceEvent | |
~BlockPlaceEvent | |
getPlayer | Gets the player who placed the block involved in this event. |
getBlockPlacedState | Gets the BlockState for the block which was placed. |
getBlockReplaced | Gets the block which was replaced. |
getBlockAgainst | Gets 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=defaultmethgetPlayerconst
Player& getPlayer() constGets the player who placed the block involved in this event.
methgetBlockPlacedStateconst
BlockState& getBlockPlacedState() constGets the BlockState for the block which was placed.
Returns
| Type | Description |
|---|---|
BlockState& | The BlockState for the block which was placed. |
methgetBlockReplacedconst
Block& getBlockReplaced() constGets the block which was replaced.
methgetBlockAgainstconst
Block& getBlockAgainst() constGets the block that this 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() constGet the message to broadcast.
methsetMessage
void setMessage(Message message)Set the message to broadcast.
Parameters
| Name | Type | Description |
|---|---|---|
message | Message | New message to broadcast |
methgetRecipientsconst
const std::unordered_set<const CommandSender*>& getRecipients() constGets a set of recipients that this broadcast message will be displayed to.
Returns
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
isCancelled | Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins. |
setCancelled | Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins. |
cancel | Cancel this event. A cancelled event will not be executed in the server, but will still pass to other plugins. |
methisCancelledvirtualconstoverride
bool isCancelled() const overrideGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
Returns
| Type | Description |
|---|---|
bool | true if this event is cancelled |
methsetCancelledvirtualoverride
void setCancelled(bool cancel) overrideSets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
Parameters
| Name | Type | Description |
|---|---|---|
cancel | bool | true if you wish to cancel this event |
methcancelvirtualoverride
void cancel() finalCancel 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
| Name | Description |
|---|---|
ChunkEvent | |
getChunk |
classChunkLoadEvent
Defined in <endstone/event/chunk/chunk_load_event.h>
Bases: ChunkEvent
Called when a chunk is loaded.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
ChunkLoadEvent | |
~ChunkLoadEvent |
methENDSTONE_EVENT
ENDSTONE_EVENT(ChunkLoadEvent)methChunkLoadEventexplicit
ChunkLoadEvent(Chunk& chunk)meth~ChunkLoadEvent
~ChunkLoadEvent() override=defaultclassChunkUnloadEvent
Defined in <endstone/event/chunk/chunk_unload_event.h>
Bases: ChunkEvent
Called when a chunk is unloaded.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
ChunkUnloadEvent | |
~ChunkUnloadEvent |
methENDSTONE_EVENT
ENDSTONE_EVENT(ChunkUnloadEvent)methChunkUnloadEventexplicit
ChunkUnloadEvent(Chunk& chunk)meth~ChunkUnloadEvent
~ChunkUnloadEvent() override=defaultclassDimensionEvent
Defined in <endstone/event/level/dimension_event.h>
Bases: LevelEvent
Represents events within a level.
Methods
| Name | Description |
|---|---|
DimensionEvent | |
getDimension |
methDimensionEventexplicit
DimensionEvent(Dimension& dimension)methgetDimensionconst
Dimension& getDimension() constGets the dimension primarily involved with this event
classEvent
Defined in <endstone/event/event.h>
Represents an event.
Methods
methEventexplicit
Event(bool async = false)methEvent
Event(const Event&) =deletemethoperator=
methEvent
Event(Event&&) =defaultmethoperator=
meth~Eventvirtual
~Event() =defaultmethgetEventNameabstractconst
std::string getEventName() const =0Gets a user-friendly identifier for this event.
Returns
| Type | Description |
|---|---|
std::string | name of this event |
methisAsynchronousconst
bool isAsynchronous() constAny custom event that should not by synchronized with other events must use the specific constructor.
Returns
| Type | Description |
|---|---|
bool | false 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() constGets the plugin for this registration
methgetPriorityconst
EventPriority getPriority() constGets the priority for this registration
Returns
| Type | Description |
|---|---|
EventPriority | Registered Priority |
methisIgnoreCancelledconst
bool isIgnoreCancelled() constWhether this listener accepts cancelled events
Returns
| Type | Description |
|---|---|
bool | True when ignoring cancelled events |
methcallEventconst
void callEvent(Event& event) constCalls the event executor
Parameters
| Name | Type | Description |
|---|---|---|
event | Event& | The event |
methgetEventTypeconst
std::string getEventType() constGets the event type for this registration
Returns
| Type | Description |
|---|---|
std::string | Registered 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
| Name | Type | Description |
|---|---|---|
handler | std::unique_ptr<EventHandler> | Event handler to register |
Returns
| Type | Description |
|---|---|
EventHandler* | the pointer to the registered handler |
methunregister
void unregister(const EventHandler& handler)Remove a handler from a specific order slot
Parameters
| Name | Type | Description |
|---|---|---|
handler | const EventHandler& | Event handler to remove |
methunregister
void unregister(const Plugin& plugin)Remove a specific plugin's handlers from this handler
methgetHandlersconst
std::vector<EventHandler*> getHandlers() constGet the baked registered handlers associated with this handler list
Returns
| Type | Description |
|---|---|
std::vector<EventHandler*> | the array of registered handlers |
methbakeconstprotected
void bake() constclassICancellable
Defined in <endstone/event/cancellable.h>
Methods
| Name | Description |
|---|---|
~ICancellable | |
isCancelled | |
setCancelled | |
cancel |
meth~ICancellablevirtual
~ICancellable() =defaultmethisCancelledabstractconst
bool isCancelled() const =0methsetCancelledabstract
void setCancelled(bool cancel) =0methcancelabstract
void cancel() =0classLeavesDecayEvent
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
| Name | Description |
|---|---|
ENDSTONE_EVENT |
methENDSTONE_EVENT
ENDSTONE_EVENT(LeavesDecayEvent)classLevelEvent
Defined in <endstone/event/level/level_event.h>
Bases: Event
Represents events within a level.
Methods
| Name | Description |
|---|---|
LevelEvent | |
getLevel |
classMapInitializeEvent
Defined in <endstone/event/server/map_initialize_event.h>
Bases: ServerEvent
Called when a map is initialized.
Methods
| Name | Description |
|---|---|
MapInitializeEvent | |
getMap | Gets the map initialized in this event. |
methMapInitializeEventexplicit
MapInitializeEvent(MapView& map)methgetMapconst
MapView& getMap() constGets the map initialized in this event.
Returns
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PacketReceiveEvent | |
getPacketId | Gets the ID of the packet. |
getPayload | Gets the raw packet data excluding the header. |
setPayload | Sets the raw packet data excluding the header. |
getPlayer | Returns the player involved in this event. |
getAddress | Gets the network address to which this packet is being sent. |
getSubClientId | Gets 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() constGets the ID of the packet.
Returns
| Type | Description |
|---|---|
int | The packet ID. |
methgetPayloadconst
std::string_view getPayload() constGets the raw packet data excluding the header.
Returns
| Type | Description |
|---|---|
std::string_view | The packet payload data. |
methsetPayload
void setPayload(std::string_view payload)Sets the raw packet data excluding the header.
Returns
| Type | Description |
|---|---|
void | The packet payload data. |
methgetPlayerconst
Player* getPlayer() constReturns the player involved in this event.
Note
This may return nullptr if the packet is sent before the player completes the login process.
methgetAddressconst
SocketAddress getAddress() constGets the network address to which this packet is being sent.
Returns
| Type | Description |
|---|---|
SocketAddress | The SocketAddress of the destination client. |
methgetSubClientIdconst
int getSubClientId() constGets the SubClient ID.
Note
Range is 0 to 3 (0 = primary client; 1-3 = split-screen clients).
Returns
| Type | Description |
|---|---|
int | The 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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PacketSendEvent | |
getPacketId | Gets the ID of the packet. |
getPayload | Gets the raw packet data excluding the header. |
setPayload | Sets the raw packet data excluding the header. |
getPlayer | Returns the player involved in this event. |
getAddress | Gets the network address to which this packet is being sent. |
getSubClientId | Gets 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() constGets the ID of the packet.
Returns
| Type | Description |
|---|---|
int | The packet ID. |
methgetPayloadconst
std::string_view getPayload() constGets the raw packet data excluding the header.
Returns
| Type | Description |
|---|---|
std::string_view | The packet payload data. |
methsetPayload
void setPayload(std::string_view payload)Sets the raw packet data excluding the header.
Returns
| Type | Description |
|---|---|
void | The packet payload data. |
methgetPlayerconst
Player* getPlayer() constReturns the player involved in this event.
Note
This may return nullptr if the packet is sent before the player completes the login process.
methgetAddressconst
SocketAddress getAddress() constGets the network address to which this packet is being sent.
Returns
| Type | Description |
|---|---|
SocketAddress | The SocketAddress of the destination client. |
methgetSubClientIdconst
int getSubClientId() constGets the SubClient ID.
Note
Range is 0 to 3 (0 = primary client; 1-3 = split-screen clients).
Returns
| Type | Description |
|---|---|
int | The 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
| Name | Description |
|---|---|
PlayerBedEnterEvent | |
getBed | Represents the default possible outcomes of this event. |
methPlayerBedEnterEventexplicit
methgetBedconst
Block& getBed() constRepresents 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
| Name | Type | Description |
|---|---|---|
use_bed | the action to take with the interacted bed | |
cancel | true if you wish to cancel this event |
Returns
| Type | Description |
|---|---|
Block& | The bed enter result representing the default outcome of this eventthe action to take with the interacted bedboolean cancellation state |
classPlayerBedLeaveEvent
Defined in <endstone/event/player/player_bed_leave_event.h>
Bases: PlayerEvent
Called when a player is leaving a bed.
Methods
| Name | Description |
|---|---|
PlayerBedLeaveEvent | |
~PlayerBedLeaveEvent | |
getBed | Returns the bed block involved in this event. |
methPlayerBedLeaveEventexplicit
meth~PlayerBedLeaveEvent
~PlayerBedLeaveEvent() override=defaultmethgetBedconst
Block& getBed() constReturns the bed block involved in this event.
Returns
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerChatEvent | |
getMessage | Gets the message that the player is attempting to send. |
setMessage | Sets the message that the player will send. |
setPlayer | Sets the player that this message will display as. |
getFormat | Gets the format to use to display this chat message. |
setFormat | Sets the format to use to display this chat message. |
getRecipients | Gets 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() constGets the message that the player is attempting to send.
Returns
| Type | Description |
|---|---|
std::string | Message the player is attempting to send |
methsetMessage
void setMessage(std::string message)Sets the message that the player will send.
Parameters
| Name | Type | Description |
|---|---|---|
message | std::string | New message that the player will send |
methsetPlayer
void setPlayer(Player& player)Sets the player that this message will display as.
Parameters
| Name | Type | Description |
|---|---|---|
player | Player& | New player which this event will execute as |
methgetFormatconst
std::string getFormat() constGets the format to use to display this chat message.
Returns
| Type | Description |
|---|---|
std::string | format string |
methsetFormat
void setFormat(std::string format)Sets the format to use to display this chat message.
Parameters
| Name | Type | Description |
|---|---|---|
format | std::string | format string |
methgetRecipientsconst
std::vector<Player*> getRecipients() constGets a set of recipients that this chat message will be displayed to.
Returns
| Type | Description |
|---|---|
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=defaultmethgetCommandconst
std::string getCommand() constGets the command that the player is attempting to send.
Returns
| Type | Description |
|---|---|
std::string | Command the player is attempting to send |
methsetCommand
void setCommand(std::string command)Sets the command that the player will send.
Parameters
| Name | Type | Description |
|---|---|---|
command | std::string | New command that the player will send |
classPlayerDeathEvent
Defined in <endstone/event/actor/player_death_event.h>
Bases: ActorDeathEvent
Called when a Player dies.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerDeathEvent | |
getPlayer | Returns the Player involved in this event. |
getDeathMessage | Get the death message that will appear to everyone on the server. |
setDeathMessage | Set 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() constReturns the Player involved in this event.
methgetDeathMessageconst
std::optional<Message> getDeathMessage() constGet the death message that will appear to everyone on the server.
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
death_message | std::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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerDimensionChangeEvent | |
getFrom | Gets the dimension the player is switching from. |
getTo | Gets the dimension the player is switching to. |
methENDSTONE_EVENT
ENDSTONE_EVENT(PlayerDimensionChangeEvent)methPlayerDimensionChangeEventexplicit
methgetFromconst
Dimension& getFrom() constGets the dimension the player is switching from.
Returns
| Type | Description |
|---|---|
Dimension& | player's previous dimension |
methgetToconst
Dimension& getTo() constGets the dimension the player is switching to.
Returns
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
PlayerDropItemEvent | |
getItem | Gets the ItemStack 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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerEmoteEvent | |
~PlayerEmoteEvent | |
getEmoteId | Gets the emote piece ID. |
isMuted | Gets the muted state for the emote. |
setMuted | Sets 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=defaultmethgetEmoteIdconst
std::string getEmoteId() constGets the emote piece ID.
Returns
| Type | Description |
|---|---|
std::string | The emote piece ID |
methisMutedconst
bool isMuted() constGets the muted state for the emote.
This method determines whether the emote is being executed without sending a chat message about the emote.
Returns
| Type | Description |
|---|---|
bool | true 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
| Name | Type | Description |
|---|---|---|
muted | bool | true 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
| Name | Description |
|---|---|
player_ |
Methods
| Name | Description |
|---|---|
PlayerEvent | |
~PlayerEvent | |
getPlayer |
varplayer_protected
std::reference_wrapper<Player> player_methPlayerEventexplicit
PlayerEvent(Player& player)meth~PlayerEvent
~PlayerEvent() override=defaultmethgetPlayerconst
Player& getPlayer() constReturns the player 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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerGameModeChangeEvent | |
~PlayerGameModeChangeEvent | |
getNewGameMode | Gets the GameMode the player is switched to. |
methENDSTONE_EVENT
ENDSTONE_EVENT(PlayerGameModeChangeEvent)methPlayerGameModeChangeEventexplicit
meth~PlayerGameModeChangeEvent
~PlayerGameModeChangeEvent() override=defaultmethgetNewGameModeconst
GameMode getNewGameMode() constGets the GameMode the player is switched to.
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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerInteractActorEvent | |
~PlayerInteractActorEvent | |
getActor | Gets the actor that was right-clicked by the player. |
methENDSTONE_EVENT
ENDSTONE_EVENT(PlayerInteractActorEvent)methPlayerInteractActorEventexplicit
meth~PlayerInteractActorEvent
~PlayerInteractActorEvent() override=defaultmethgetActorconst
Actor& getActor() constGets the actor that was right-clicked by the player.
Returns
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
Action |
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerInteractEvent | |
getAction | Returns the action type. |
hasItem | Check if this event involved an item. |
getItem | Returns the item in hand represented by this event. |
hasBlock | Check if this event involved a block. |
getBlock | Returns the clicked block. |
getBlockFace | Returns the face of the block that was clicked. |
getClickedPosition | Gets the exact position on the block the player interacted with. |
enumAction
ActionValues
| Name | Value | Description |
|---|---|---|
LeftClickBlock | Left-clicking a block | |
RightClickBlock | Right-clicking a block | |
LeftClickAir | Left-clicking the air | |
RightClickAir | Right-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() constReturns the action type.
methhasItemconst
bool hasItem() constCheck if this event involved an item.
Returns
| Type | Description |
|---|---|
bool | boolean true if it did |
methgetItemconst
const std::optional<ItemStack>& getItem() constReturns the item in hand represented by this event.
Returns
| Type | Description |
|---|---|
const std::optional<ItemStack>& | ItemStack the item used, or std::nullopt if no item |
methhasBlockconst
bool hasBlock() constCheck if this event involved a block.
Returns
| Type | Description |
|---|---|
bool | boolean true if it did |
methgetBlockconst
Block* getBlock() constReturns the clicked block.
methgetBlockFaceconst
BlockFace getBlockFace() constReturns the face of the block that was clicked.
methgetClickedPositionconst
std::optional<Vector> getClickedPosition() constGets 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
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
PlayerItemConsumeEvent | |
getItem | Gets the item that is being consumed. |
getHand | Get the hand used to consume the item. |
methPlayerItemConsumeEventexplicit
PlayerItemConsumeEvent(Player& player, ItemStack item, EquipmentSlot hand)methgetItemconst
const ItemStack& getItem() constGets the item that is being consumed.
methgetHandconst
EquipmentSlot getHand() constGet the hand used to consume the item.
Returns
| Type | Description |
|---|---|
EquipmentSlot | the 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
| Name | Description |
|---|---|
PlayerItemHeldEvent | |
getPreviousSlot | Gets the previous held slot index. |
getNewSlot | Gets the new held slot index. |
methPlayerItemHeldEventexplicit
PlayerItemHeldEvent(Player& player, const int previous, const int current)methgetPreviousSlotconst
int getPreviousSlot() constGets the previous held slot index.
Returns
| Type | Description |
|---|---|
int | Previous slot index |
methgetNewSlotconst
int getNewSlot() constGets the new held slot index.
Returns
| Type | Description |
|---|---|
int | New slot index |
classPlayerJoinEvent
Defined in <endstone/event/player/player_join_event.h>
Bases: PlayerEvent
Called when a player joins a server.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerJoinEvent | |
getJoinMessage | Gets the join message to send to all online players. |
setJoinMessage | Sets 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() constGets the join message to send to all online players.
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
message | std::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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerMoveEvent |
methENDSTONE_EVENT
ENDSTONE_EVENT(PlayerJumpEvent)methPlayerMoveEventexplicit
classPlayerKickEvent
Defined in <endstone/event/player/player_kick_event.h>
Bases: Cancellable<PlayerEvent>
Called when a player gets kicked from the server.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerKickEvent | |
getReason | Gets the reason why the player is getting kicked. |
setReason | Sets the reason why the player is getting kicked. |
methENDSTONE_EVENT
ENDSTONE_EVENT(PlayerKickEvent)methPlayerKickEventexplicit
PlayerKickEvent(Player& player, std::string reason)methgetReasonconst
std::string getReason() constGets the reason why the player is getting kicked.
Returns
| Type | Description |
|---|---|
std::string | string kick reason |
methsetReason
void setReason(std::string reason)Sets the reason why the player is getting kicked.
Parameters
| Name | Type | Description |
|---|---|---|
reason | std::string | kick 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=defaultmethgetKickMessageconst
const std::string& getKickMessage() constGets the current kick message that will be used if event is cancelled
Returns
| Type | Description |
|---|---|
const std::string& | Current kick message |
methsetKickMessage
void setKickMessage(const std::string& message)Sets the kick message to display if event is cancelled
Parameters
| Name | Type | Description |
|---|---|---|
message | const std::string& | New kick message |
classPlayerMoveEvent
Defined in <endstone/event/player/player_move_event.h>
Bases: Cancellable<PlayerEvent>
Called when a player moves.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerMoveEvent | |
getFrom | Gets the location this player moved from. |
setFrom | Sets the location to mark as where the player moved from. |
getTo | Gets the location this player moved to. |
setTo | Sets the location that this player will move to. |
varfrom_
Location from_varto_
Location to_methENDSTONE_EVENT
ENDSTONE_EVENT(PlayerMoveEvent)methPlayerMoveEventexplicit
methgetFromconst
const Location& getFrom() constGets the location this player moved from.
methsetFrom
void setFrom(const Location& from)Sets the location to mark as where the player moved from.
Parameters
| Name | Type | Description |
|---|---|---|
from | const Location& | New location to mark as the players previous location |
methgetToconst
const Location& getTo() constGets the location this player moved to.
methsetTo
void setTo(const Location& to)Sets the location that 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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerPickupItemEvent | |
getItem | Gets the Item picked up by the entity. |
methENDSTONE_EVENT
ENDSTONE_EVENT(PlayerPickupItemEvent)methPlayerPickupItemEventexplicit
methgetItemconst
Item& getItem() constGets the Item picked up by the entity.
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
| Name | Description |
|---|---|
ENDSTONE_EVENT |
methENDSTONE_EVENT
ENDSTONE_EVENT(PlayerPortalEvent)classPlayerQuitEvent
Defined in <endstone/event/player/player_quit_event.h>
Bases: PlayerEvent
Called when a player leaves a server.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerQuitEvent | |
getQuitMessage | Gets the quit message to send to all online players. |
setQuitMessage | Sets 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() constGets the quit message to send to all online players.
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
message | std::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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerRespawnEvent | |
~PlayerRespawnEvent |
methENDSTONE_EVENT
ENDSTONE_EVENT(PlayerRespawnEvent)methPlayerRespawnEventexplicit
PlayerRespawnEvent(Player& player)meth~PlayerRespawnEvent
~PlayerRespawnEvent() override=defaultclassPlayerSkinChangeEvent
Defined in <endstone/event/player/player_skin_change_event.h>
Bases: Cancellable<PlayerEvent>
Called when a player changes their skin.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerSkinChangeEvent | |
getNewSkin | Gets the player's new skin. |
getSkinChangeMessage | Gets the message to send to all online players for this skin change. |
setSkinChangeMessage | Sets 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() constGets the player's new skin.
Returns
| Type | Description |
|---|---|
Skin | The skin that will be applied. |
methgetSkinChangeMessageconst
std::optional<Message> getSkinChangeMessage() constGets the message to send to all online players for this skin change.
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
message | std::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
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PlayerMoveEvent |
methENDSTONE_EVENT
ENDSTONE_EVENT(PlayerTeleportEvent)methPlayerMoveEventexplicit
classPluginDisableEvent
Defined in <endstone/event/server/plugin_disable_event.h>
Bases: ServerEvent
Called when a plugin is disabled.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PluginDisableEvent | |
getPlugin |
methENDSTONE_EVENT
ENDSTONE_EVENT(PluginDisableEvent)methPluginDisableEventexplicit
PluginDisableEvent(Plugin& plugin)methgetPluginconst
Plugin& getPlugin() constGets the plugin involved in this event
classPluginEnableEvent
Defined in <endstone/event/server/plugin_enable_event.h>
Bases: ServerEvent
Called when a plugin is enabled.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
PluginEnableEvent | |
getPlugin |
methENDSTONE_EVENT
ENDSTONE_EVENT(PluginEnableEvent)methPluginEnableEventexplicit
PluginEnableEvent(Plugin& plugin)methgetPluginconst
Plugin& getPlugin() constGets the plugin involved in 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() constGet the message id to send.
Returns
| Type | Description |
|---|---|
const std::string& | Message id to send |
methgetMessageconst
const std::string& getMessage() constGet the message to send.
Returns
| Type | Description |
|---|---|
const std::string& | Message to send |
methgetSenderconst
const CommandSender& getSender() constGets the command sender who initiated the command
Returns
| Type | Description |
|---|---|
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() constGets the command that the server is attempting to execute from the console
Returns
| Type | Description |
|---|---|
std::string | Command the server is attempting to execute |
methsetCommand
void setCommand(std::string message)Sets the command that the server will execute
Parameters
| Name | Type | Description |
|---|---|---|
message | std::string | New message that the server will execute |
methgetSenderconst
CommandSender& getSender() constGet the command sender.
Returns
| Type | Description |
|---|---|
CommandSender& | The sender |
classServerEvent
Defined in <endstone/event/server/server_event.h>
Bases: Event
Represents a Server-related event.
classServerListPingEvent
Defined in <endstone/event/server/server_list_ping_event.h>
Bases: Cancellable<ServerEvent>
Called when a server ping is coming in.
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
ServerListPingEvent | |
getAddress | Get the address the ping is coming from. |
getServerGuid | Get the unique identifier of the server. |
setServerGuid | Set the unique identifier of the server. |
getLocalPort | Get the local port of the server. |
setLocalPort | Set the local port of the server. |
getLocalPortV6 | Get the local port of the server for IPv6 support. |
setLocalPortV6 | Set the local port of the server for IPv6 support. |
getMotd | Get the message of the day message. |
setMotd | Change the message of the day message. |
getNetworkProtocolVersion | Get the network protocol version of this server. |
getMinecraftVersionNetwork | Get the network version of Minecraft that is supported by this server. |
setMinecraftVersionNetwork | Set the network version of Minecraft that is supported by this server. |
getNumPlayers | Get the number of players online. |
setNumPlayers | Set the number of players online. |
getMaxPlayers | Get the maximum number of players allowed. |
setMaxPlayers | Set the maximum number of players allowed. |
getLevelName | Get the level name. |
setLevelName | Set the level name. |
getGameMode | Get the current game mode. |
setGameMode | Set 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() constGet the address the ping is coming from.
Returns
| Type | Description |
|---|---|
SocketAddress | the address |
methgetServerGuidconst
std::string getServerGuid() constGet the unique identifier of the server.
Returns
| Type | Description |
|---|---|
std::string | The server guid |
methsetServerGuid
void setServerGuid(std::string guid)Set the unique identifier of the server.
Parameters
| Name | Type | Description |
|---|---|---|
guid | std::string | the server guid |
methgetLocalPortconst
int getLocalPort() constGet the local port of the server.
Returns
| Type | Description |
|---|---|
int | The local port |
methsetLocalPort
void setLocalPort(int port)Set the local port of the server.
Parameters
| Name | Type | Description |
|---|---|---|
port | int | the local port |
methgetLocalPortV6const
int getLocalPortV6() constGet the local port of the server for IPv6 support.
Returns
| Type | Description |
|---|---|
int | The local port for IPv6 |
methsetLocalPortV6
void setLocalPortV6(int port)Set the local port of the server for IPv6 support.
Parameters
| Name | Type | Description |
|---|---|---|
port | int | the local port for IPv6 |
methgetMotdconst
std::string getMotd() constGet the message of the day message.
Returns
| Type | Description |
|---|---|
std::string | the message of the day |
methsetMotd
void setMotd(std::string motd)Change the message of the day message.
Parameters
| Name | Type | Description |
|---|---|---|
motd | std::string | the message of the day |
methgetNetworkProtocolVersionconst
int getNetworkProtocolVersion() constGet the network protocol version of this server.
Returns
| Type | Description |
|---|---|
int | the network protocol version |
methgetMinecraftVersionNetworkconst
std::string getMinecraftVersionNetwork() constGet the network version of Minecraft that is supported by this server.
Returns
| Type | Description |
|---|---|
std::string | the 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
| Name | Type | Description |
|---|---|---|
minecraft_version_network | std::string | the network version of Minecraft |
methgetNumPlayersconst
int getNumPlayers() constGet the number of players online.
Returns
| Type | Description |
|---|---|
int | the number of players |
methsetNumPlayers
void setNumPlayers(int num_players)Set the number of players online.
Parameters
| Name | Type | Description |
|---|---|---|
num_players | int | the number of players |
methgetMaxPlayersconst
int getMaxPlayers() constGet the maximum number of players allowed.
Returns
| Type | Description |
|---|---|
int | the maximum number of players |
methsetMaxPlayers
void setMaxPlayers(int max_players)Set the maximum number of players allowed.
Parameters
| Name | Type | Description |
|---|---|---|
max_players | int | the maximum number of players |
methgetLevelNameconst
std::string getLevelName() constGet the level name.
Returns
| Type | Description |
|---|---|
std::string | the level name |
methsetLevelName
void setLevelName(std::string level_name)Set the level name.
Parameters
| Name | Type | Description |
|---|---|---|
level_name | std::string | the level name |
methgetGameModeconst
GameMode getGameMode() constGet the current game mode.
Returns
| Type | Description |
|---|---|
GameMode | the game mode |
methsetGameMode
void setGameMode(GameMode game_mode)Set the current game mode.
Parameters
| Name | Type | Description |
|---|---|---|
game_mode | GameMode | the 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
| Name | Description |
|---|---|
LoadType |
Methods
| Name | Description |
|---|---|
ENDSTONE_EVENT | |
ServerLoadEvent | |
getType |
enumLoadType
LoadTypeValues
| Name | Value | Description |
|---|---|---|
Startup | ||
Reload |
methENDSTONE_EVENT
ENDSTONE_EVENT(ServerLoadEvent)methServerLoadEventexplicit
ServerLoadEvent(LoadType type)methgetTypeconst
LoadType getType() constclassThunderChangeEvent
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=defaultmethtoThunderStateconst
bool toThunderState() constGets the state of thunder that the world is being set to
Returns
| Type | Description |
|---|---|
bool | true 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=defaultmethtoWeatherStateconst
bool toWeatherState() constGets the state of weather that the world is being set to
Returns
| Type | Description |
|---|---|
bool | true 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
| Name | Description |
|---|---|
WeatherEvent | |
~WeatherEvent | |
getLevel |
methWeatherEventexplicit
WeatherEvent(Level& level)meth~WeatherEvent
~WeatherEvent() override=defaultmethgetLevelconst
Level& getLevel() constReturns the Level where this event is occurring
enumEventPriority
EventPriorityRepresents 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
| Name | Value | Description |
|---|---|---|
Lowest | 0 | Event call is of very low importance and should be run first, to allow other plugins to further customise the outcome |
Low | 1 | Event call is of low importance |
Normal | 2 | Event call is neither important nor unimportant, and may be run normally |
High | 3 | Event call is of high importance |
Highest | 4 | Event call is critical and must have the final say in what happens to the event |
Monitor | 5 | Event is listened to purely for monitoring the outcome of an event. No modifications to the event should be made under this priority |
enumEventResult
EventResultValues
| Name | Value | Description |
|---|---|---|
Deny | Deny the event. | |
Default | Neither deny nor allow the event. The server will proceed with its normal handling. | |
Allow | Allow / Force the event. |