Skip to Content
⚠ Under Construction
ReferencePython APIendstone.event

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
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
CancellableRepresents an event 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 dimension
EventRepresents an event.
EventPriorityListeners are called in following order: LOWEST -> LOW -> NORMAL -> HIGH -> HIGHEST -> MONITOR
EventResult
LeavesDecayEventCalled when leaves are decaying naturally.
LevelEventRepresents events within a level
MobEventRepresents an Mob-related event.
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
PlayerDropItemEventCalled when a player drops an item from their inventory
PlayerEmoteEventCalled when a player uses and 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 right-clicks a block.
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.
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

Methods:

NameDescription
event_handler

ActorDamageEvent

Bases: MobEvent, Cancellable

Called when an Actor is damaged.

Attributes:

NameTypeDescription
damagefloatGets or sets the amount of damage caused by the event
damage_sourceDamageSourceGets the source of damage.

damage

damage: float

Gets or sets the amount of damage caused by the event

damage_source

damage_source: DamageSource

Gets the source of damage.

ActorDeathEvent

Bases: MobEvent

Called when an Actor dies.

Attributes:

NameTypeDescription
damage_sourceDamageSourceGets the source of damage which caused the death.

damage_source

damage_source: DamageSource

Gets the source of damage which caused the death.

ActorEvent

Bases: Event

Represents an Actor-related event.

Attributes:

NameTypeDescription
actorActorReturns the Actor involved in this event

actor

actor: Actor

Returns the Actor involved in this event

ActorExplodeEvent

Bases: ActorEvent, Cancellable

Called when an Actor explodes.

Attributes:

NameTypeDescription
block_listlist[Block]Gets or sets the list of blocks that would have been removed or were removed from the explosion event.
locationLocationReturns the location where the explosion happened.

block_list

block_list: list[Block]

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

location

location: Location

Returns the location where the explosion happened.

ActorKnockbackEvent

Bases: MobEvent, Cancellable

Called when a living entity receives knockback.

Attributes:

NameTypeDescription
knockbackVectorGets or sets the knockback that will be applied to the entity.
sourceActorGet the source actor that has caused knockback to the defender, if exists.

knockback

knockback: Vector

Gets or sets the knockback that will be applied to the entity.

source

source: Actor

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

ActorRemoveEvent

Bases: ActorEvent

Called when an Actor is removed.

ActorSpawnEvent

Bases: ActorEvent, Cancellable

Called when an Actor is spawned into a world.

ActorTeleportEvent

Bases: ActorEvent, Cancellable

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

Attributes:

NameTypeDescription
from_locationLocationGets or sets the location that this actor moved from.
to_locationLocationGets or sets the location that this actor moved to.

from_location

from_location: Location

Gets or sets the location that this actor moved from.

to_location

to_location: Location

Gets or sets the location that this actor moved to.

BlockBreakEvent

Bases: BlockEvent, Cancellable

Called when a block is broken by a player.

Attributes:

NameTypeDescription
playerPlayerGets the Player that is breaking the block involved in this event.

player

player: Player

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

BlockCookEvent

Bases: BlockEvent, Cancellable

Called when an ItemStack is successfully cooked in a block.

Attributes:

NameTypeDescription
resultItemStackGets or sets the resultant ItemStack for this event
sourceItemStackGets the smelted ItemStack for this event

result

result: ItemStack

Gets or sets the resultant ItemStack for this event

source

source: ItemStack

Gets the smelted ItemStack for this event

BlockEvent

Bases: Event

Represents an Block-related event

Attributes:

NameTypeDescription
blockBlockGets the block involved in this event.

block

block: Block

Gets the block involved in this event.

BlockPistonEvent

Bases: BlockEvent, Cancellable

Called when a piston block is triggered

Attributes:

NameTypeDescription
directionBlockFaceReturn the direction in which the piston will operate.

direction

direction: BlockFace

Return the direction in which the piston will operate.

BlockPistonExtendEvent

Bases: BlockPistonEvent

Called when a piston extends.

BlockPistonRetractEvent

Bases: BlockPistonEvent

Called when a piston retracts.

BlockPlaceEvent

Bases: BlockEvent, Cancellable

Called when a block is placed by a player.

Attributes:

NameTypeDescription
block_againstBlockGets the block that this block was placed against
block_placed_stateBlockStateGets the BlockState for the block which was placed.
block_replacedBlockGets the block which was replaced.
playerPlayerGets the player who placed the block involved in this event.

block_against

block_against: Block

Gets the block that this block was placed against

block_placed_state

block_placed_state: BlockState

Gets the BlockState for the block which was placed.

block_replaced

block_replaced: Block

Gets the block which was replaced.

player

player: Player

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

BroadcastMessageEvent

Bases: ServerEvent, Cancellable

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

Attributes:

NameTypeDescription
messagestr | TranslatableGets or sets the message to broadcast.
recipientsset[CommandSender]Gets a set of recipients that this broadcast message will be displayed to.

message

message: str | Translatable

Gets or sets the message to broadcast.

recipients

recipients: set[CommandSender]

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

Cancellable

Represents an event that may be cancelled by a plugin or the server.

Methods:

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

Attributes:

NameTypeDescription
cancelledboolGets or sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins. [Warning] Deprecated: Use is_cancelled instead.
is_cancelledboolGets or sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

cancelled

cancelled: bool

Gets or sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins. [Warning] Deprecated: Use is_cancelled instead.

is_cancelled

is_cancelled: bool

Gets or 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() -> None

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

ChunkEvent

Bases: DimensionEvent

Represents a Chunk related event

Attributes:

NameTypeDescription
chunkChunkGets the chunk being loaded/unloaded

chunk

chunk: Chunk

Gets the chunk being loaded/unloaded

ChunkLoadEvent

Bases: ChunkEvent

Called when a chunk is loaded

ChunkUnloadEvent

Bases: ChunkEvent

Called when a chunk is unloaded

DimensionEvent

Bases: LevelEvent

Represents events within a dimension

Attributes:

NameTypeDescription
dimensionDimensionGets the dimension primarily involved with this event

dimension

dimension: Dimension

Gets the dimension primarily involved with this event

Event

Represents an event.

Attributes:

NameTypeDescription
event_namestrGets a user-friendly identifier for this event.
is_asynchronousboolWhether the event fires asynchronously.

event_name

event_name: str

Gets a user-friendly identifier for this event.

is_asynchronous

is_asynchronous: bool

Whether the event fires asynchronously.

EventPriority

EventPriority(value:int)

Listeners are called in following order: LOWEST -> LOW -> NORMAL -> HIGH -> HIGHEST -> MONITOR

Attributes:

HIGH

HIGH: EventPriority

HIGHEST

HIGHEST: EventPriority

LOW

LOW: EventPriority

LOWEST

LOWEST: EventPriority

MONITOR

MONITOR: EventPriority

NORMAL

NORMAL: EventPriority

name

name: str

value

value: int

EventResult

EventResult(value:int)

Attributes:

ALLOW

ALLOW: EventResult

DEFAULT

DEFAULT: EventResult

DENY

DENY: EventResult

name

name: str

value

value: int

LeavesDecayEvent

Bases: BlockEvent, Cancellable

Called when leaves are decaying naturally. If a Leaves Decay event is cancelled, the leaves will not decay.

LevelEvent

Bases: Event

Represents events within a level

Attributes:

NameTypeDescription
levelLevelGets the level primarily involved with this event

level

level: Level

Gets the level primarily involved with this event

MobEvent

Bases: Event

Represents an Mob-related event.

Attributes:

NameTypeDescription
actorMobReturns the Mob involved in this event

actor

actor: Mob

Returns the Mob involved in this event

PacketReceiveEvent

Bases: ServerEvent, Cancellable

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

Attributes:

NameTypeDescription
addressSocketAddressGets the network address to which this packet is being sent.
packet_idintGets the ID of the packet.
payloadbytesGets or sets the raw packet data excluding the header.
playerPlayerGets the player involved in this event
sub_client_idintGets the SubClient ID (0 = primary client; 1-3 = split-screen clients).

address

address: SocketAddress

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

packet_id

packet_id: int

Gets the ID of the packet.

payload

payload: bytes

Gets or sets the raw packet data excluding the header.

player

player: Player

Gets the player involved in this event NOTE: This may return None if the packet is sent before the player completes the login process.

sub_client_id

sub_client_id: int

Gets the SubClient ID (0 = primary client; 1-3 = split-screen clients).

PacketSendEvent

Bases: ServerEvent, Cancellable

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

Attributes:

NameTypeDescription
addressSocketAddressGets the network address to which this packet is being sent.
packet_idintGets the ID of the packet.
payloadbytesGets or sets the raw packet data excluding the header.
playerPlayerGets the player involved in this event
sub_client_idintGets the SubClient ID (0 = primary client; 1-3 = split-screen clients).

address

address: SocketAddress

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

packet_id

packet_id: int

Gets the ID of the packet.

payload

payload: bytes

Gets or sets the raw packet data excluding the header.

player

player: Player

Gets the player involved in this event NOTE: This may return None if the packet is sent before the player completes the login process.

sub_client_id

sub_client_id: int

Gets the SubClient ID (0 = primary client; 1-3 = split-screen clients).

PlayerBedEnterEvent

Bases: PlayerEvent, Cancellable

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

Attributes:

NameTypeDescription
bedBlockReturns the bed block involved in this event.

bed

bed: Block

Returns the bed block involved in this event.

PlayerBedLeaveEvent

Bases: PlayerEvent

Called when a player is leaving a bed.

Attributes:

NameTypeDescription
bedBlockReturns the bed block involved in this event.

bed

bed: Block

Returns the bed block involved in this event.

PlayerChatEvent

Bases: PlayerEvent, Cancellable

Called when a player sends a chat message.

Attributes:

NameTypeDescription
messagestrGets or sets the message that the player will send.

message

message: str

Gets or sets the message that the player will send.

PlayerCommandEvent

Bases: PlayerEvent, Cancellable

Called whenever a player runs a command.

Attributes:

NameTypeDescription
commandstrGets or sets the command that the player will send.

command

command: str

Gets or sets the command that the player will send.

PlayerDeathEvent

Bases: ActorDeathEvent, PlayerEvent

Called when a player dies

Attributes:

NameTypeDescription
death_messagestr | Translatable | NoneGets or sets the death message that will appear to everyone on the server.

death_message

death_message: str | Translatable | None

Gets or sets the death message that will appear to everyone on the server.

PlayerDropItemEvent

Bases: PlayerEvent, Cancellable

Called when a player drops an item from their inventory

Attributes:

NameTypeDescription
itemItemStackGets the ItemStack dropped by the player

item

item: ItemStack

Gets the ItemStack dropped by the player

PlayerEmoteEvent

Bases: PlayerEvent, Cancellable

Called when a player uses and emote

Attributes:

NameTypeDescription
emote_idstrGets the emote piece ID
is_mutedboolGets or sets the muted state for the emote.

emote_id

emote_id: str

Gets the emote piece ID

is_muted

is_muted: bool

Gets or sets the muted state for the emote.

PlayerEvent

Bases: Event

Represents a player related event

Attributes:

NameTypeDescription
playerPlayerReturns the player involved in this event.

player

player: Player

Returns the player involved in this event.

PlayerGameModeChangeEvent

Bases: PlayerEvent, Cancellable

Called when the GameMode of the player is changed.

Attributes:

NameTypeDescription
new_game_modeGameModeGets the GameMode the player is switched to.

new_game_mode

new_game_mode: GameMode

Gets the GameMode the player is switched to.

PlayerInteractActorEvent

Bases: PlayerEvent, Cancellable

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

Attributes:

NameTypeDescription
actorActorGets the actor that was right-clicked by the player.

actor

actor: Actor

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

PlayerInteractEvent

Bases: PlayerEvent, Cancellable

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

Classes:

NameDescription
Action

Attributes:

NameTypeDescription
actionActionReturns the action type of interaction
blockBlockReturns the clicked block
block_faceBlockFaceReturns the face of the block that was clicked
clicked_positionVector | NoneGets the exact position on the block the player interacted with.
has_blockboolCheck if this event involved a block
has_itemboolCheck if this event involved an item
itemItemStackReturns the item in hand represented by this event

action

action: PlayerInteractEvent.Action

Returns the action type of interaction

block

block: Block

Returns the clicked block

block_face

block_face: BlockFace

Returns the face of the block that was clicked

clicked_position

clicked_position: Vector | None

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

has_block

has_block: bool

Check if this event involved a block

has_item

has_item: bool

Check if this event involved an item

item

item: ItemStack

Returns the item in hand represented by this event

Action

Action(value:int)

Attributes:

LEFT_CLICK_AIR
LEFT_CLICK_AIR: PlayerInteractEvent.Action
LEFT_CLICK_BLOCK
LEFT_CLICK_BLOCK: PlayerInteractEvent.Action
RIGHT_CLICK_AIR
RIGHT_CLICK_AIR: PlayerInteractEvent.Action
RIGHT_CLICK_BLOCK
RIGHT_CLICK_BLOCK: PlayerInteractEvent.Action
name
name: str
value
value: int

PlayerItemConsumeEvent

Bases: PlayerEvent, Cancellable

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

Attributes:

NameTypeDescription
handEquipmentSlotGet the hand used to consume the item.
itemItemStackGets or sets the item that is being consumed.

hand

hand: EquipmentSlot

Get the hand used to consume the item.

item

item: ItemStack

Gets or sets the item that is being consumed.

PlayerItemHeldEvent

Bases: PlayerEvent, Cancellable

Called when a player changes their currently held item.

Attributes:

NameTypeDescription
new_slotintGets the new held slot index
previous_slotintGets the previous held slot index.

new_slot

new_slot: int

Gets the new held slot index

previous_slot

previous_slot: int

Gets the previous held slot index.

PlayerJoinEvent

Bases: PlayerEvent

Called when a player joins a server

Attributes:

NameTypeDescription
join_messagestr | Translatable | NoneGets or sets the join message to send to all online players.

join_message

join_message: str | Translatable | None

Gets or sets the join message to send to all online players.

PlayerJumpEvent

Bases: PlayerMoveEvent

Called when a player jumps.

PlayerKickEvent

Bases: PlayerEvent, Cancellable

Called when a player gets kicked from the server

Attributes:

NameTypeDescription
reasonstrGets or sets the reason why the player is getting kicked

reason

reason: str

Gets or sets the reason why the player is getting kicked

PlayerLoginEvent

Bases: PlayerEvent, Cancellable

Called when a player attempts to login in.

Attributes:

NameTypeDescription
kick_messagestrGets or sets kick message to display if event is cancelled

kick_message

kick_message: str

Gets or sets kick message to display if event is cancelled

PlayerMoveEvent

Bases: PlayerEvent, Cancellable

Called when a player moves.

Attributes:

NameTypeDescription
from_locationLocationGets or sets the location that this player moved from.
to_locationLocationGets or sets the location that this player moved to.

from_location

from_location: Location

Gets or sets the location that this player moved from.

to_location

to_location: Location

Gets or sets the location that this player moved to.

PlayerPickupItemEvent

Bases: PlayerEvent, Cancellable

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

Attributes:

NameTypeDescription
itemItemGets the Item picked up by the entity.

item

item: Item

Gets the Item picked up by the entity.

PlayerQuitEvent

Bases: PlayerEvent

Called when a player leaves a server.

Attributes:

NameTypeDescription
quit_messagestr | Translatable | NoneGets or sets the quit message to send to all online players.

quit_message

quit_message: str | Translatable | None

Gets or sets the quit message to send to all online players.

PlayerRespawnEvent

Bases: PlayerEvent

Called when a player respawns.

PlayerSkinChangeEvent

Bases: PlayerEvent, Cancellable

Called when a player changes their skin.

Attributes:

NameTypeDescription
new_skinSkinGets the player’s new skin.
skin_change_messagestr | Translatable | NoneGets or sets the message to send to all online players for this skin change.

new_skin

new_skin: Skin

Gets the player’s new skin.

skin_change_message

skin_change_message: str | Translatable | None

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

PlayerTeleportEvent

Bases: PlayerMoveEvent

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

PluginDisableEvent

Bases: ServerEvent

Called when a plugin is disabled.

Attributes:

NameTypeDescription
pluginPlugin

plugin

plugin: Plugin

PluginEnableEvent

Bases: ServerEvent

Called when a plugin is enabled.

Attributes:

NameTypeDescription
pluginPlugin

plugin

plugin: Plugin

ScriptMessageEvent

Bases: ServerEvent, Cancellable

Called when a message is sent by /scriptevent command

Attributes:

NameTypeDescription
messagestrGet the message to send.
message_idstrGet the message id to send.
senderCommandSenderGets the command sender who initiated the command.

message

message: str

Get the message to send.

message_id

message_id: str

Get the message id to send.

sender

sender: CommandSender

Gets the command sender who initiated the command.

ServerCommandEvent

Bases: ServerEvent, Cancellable

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

Attributes:

NameTypeDescription
commandstrGets or sets the command that the server will execute
senderCommandSenderGet the command sender.

command

command: str

Gets or sets the command that the server will execute

sender

sender: CommandSender

Get the command sender.

ServerEvent

Bases: Event

Represents a server-related event

ServerListPingEvent

Bases: ServerEvent, Cancellable

Called when a server ping is coming in.

Attributes:

NameTypeDescription
game_modeGameModeGets or sets the current game mode.
level_namestrGets or sets the level name.
local_portintGet or set the local port of the server.
local_port_v6intGet or set the local port of the server for IPv6 support
max_playersintGets or sets the maximum number of players allowed.
minecraft_version_networkstrGets or sets the network version of Minecraft that is supported by this server
motdstrGets or sets the message of the day message.
network_protocol_versionintGet the network protocol version of this server
num_playersintGets or sets the number of players online.
remote_hoststrGet the host the ping is coming from.
remote_portintGet the port the ping is coming from.
server_guidstrGet or set the unique identifier of the server.

game_mode

game_mode: GameMode

Gets or sets the current game mode.

level_name

level_name: str

Gets or sets the level name.

local_port

local_port: int

Get or set the local port of the server.

local_port_v6

local_port_v6: int

Get or set the local port of the server for IPv6 support

max_players

max_players: int

Gets or sets the maximum number of players allowed.

minecraft_version_network

minecraft_version_network: str

Gets or sets the network version of Minecraft that is supported by this server

motd

motd: str

Gets or sets the message of the day message.

network_protocol_version

network_protocol_version: int

Get the network protocol version of this server

num_players

num_players: int

Gets or sets the number of players online.

remote_host

remote_host: str

Get the host the ping is coming from.

remote_port

remote_port: int

Get the port the ping is coming from.

server_guid

server_guid: str

Get or set the unique identifier of the server.

ServerLoadEvent

Bases: Event

Called when either the server startup or reload has completed.

Classes:

NameDescription
LoadType

Attributes:

NameTypeDescription
STARTUPLoadType
typeLoadType

STARTUP

STARTUP: ServerLoadEvent.LoadType

type

type: ServerLoadEvent.LoadType

LoadType

LoadType(value:int)

Attributes:

STARTUP
STARTUP: ServerLoadEvent.LoadType
name
name: str
value
value: int

ThunderChangeEvent

Bases: WeatherEvent, Cancellable

Called when the thunder state in a world is changing.

Attributes:

NameTypeDescription
to_thunder_stateboolGets the state of thunder that the world is being set to

to_thunder_state

to_thunder_state: bool

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

WeatherChangeEvent

Bases: WeatherEvent, Cancellable

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

Attributes:

NameTypeDescription
to_weather_stateboolGets the state of weather that the world is being set to

to_weather_state

to_weather_state: bool

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

WeatherEvent

Bases: Event

Represents a weather-related event

Attributes:

NameTypeDescription
levelLevelReturns the Level where this event is occurring

level

level: Level

Returns the Level where this event is occurring

event_handler

event_handler( func=None, *, priority: EventPriority = EventPriority.NORMAL, ignore_cancelled: bool = False )
Last updated on