Skip to content

Event

endstone.event

Classes relating to handling triggered code executions.

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

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

Represents an event 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 dimension.

Event

Represents an event.

EventPriority

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

EventResult

Represents the result a plugin can apply to an event whose default behaviour can be allowed, denied, or left to the server.

LeavesDecayEvent

Called when leaves are decaying naturally.

LevelEvent

Represents events within a level.

MapInitializeEvent

Called when a map is initialized.

MobEvent

Represents an Mob-related event.

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 right-clicks a block.

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 the /scriptevent command.

ServerCommandEvent

Called when a command is run by a non-player, early in the command handling 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.

Functions:

Name Description
event_handler

ActorDamageEvent

ActorDamageEvent(is_async: bool = False)

Bases: MobEvent, Cancellable

Called when an Actor is damaged.

Attributes:

Name Type Description
damage float

The raw amount of damage caused by the event.

damage_source DamageSource

A DamageSource detailing the source of the damage.

damage property writable

damage: float

The raw amount of damage caused by the event.

damage_source property

damage_source: DamageSource

A DamageSource detailing the source of the damage.

ActorDeathEvent

ActorDeathEvent(is_async: bool = False)

Bases: MobEvent

Called when an Actor dies.

Attributes:

Name Type Description
damage_source DamageSource

A DamageSource detailing the source of the damage for the death.

damage_source property

damage_source: DamageSource

A DamageSource detailing the source of the damage for the death.

ActorEvent

ActorEvent(is_async: bool = False)

Bases: Event

Represents an Actor-related event.

Attributes:

Name Type Description
actor Actor

The Actor which is involved in this event.

actor property

actor: Actor

The Actor which is involved in this event.

ActorExplodeEvent

ActorExplodeEvent(is_async: bool = False)

Bases: ActorEvent, Cancellable

Called when an actor explodes.

Attributes:

Name Type Description
block_list list[Block]

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

location Location

The location where the explosion happened.

block_list property writable

block_list: list[Block]

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

location property

location: Location

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.

ActorKnockbackEvent

ActorKnockbackEvent(is_async: bool = False)

Bases: MobEvent, Cancellable

Called when a living entity receives knockback.

Attributes:

Name Type Description
knockback Vector

The knockback that will be applied to the entity.

source Actor

The source actor that has caused knockback to the defender, or None if the knockback is not caused by an actor.

knockback property writable

knockback: Vector

The knockback that will be applied to the entity.

Note: the getter returns a copy; changes must be applied via the setter.

source property

source: Actor

The source actor that has caused knockback to the defender, or None if the knockback is not caused by an actor.

ActorRemoveEvent

ActorRemoveEvent(is_async: bool = False)

Bases: ActorEvent

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.

ActorSpawnEvent

ActorSpawnEvent(is_async: bool = False)

Bases: ActorEvent, Cancellable

Called when an Actor is spawned into a world.

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

ActorTeleportEvent

ActorTeleportEvent(is_async: bool = False)

Bases: ActorEvent, Cancellable

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).

Attributes:

Name Type Description
from_location Location

The location that this actor moved from.

to_location Location

The location that this actor moved to.

from_location property writable

from_location: Location

The location that this actor moved from.

to_location property writable

to_location: Location

The location that this actor moved to.

BlockBreakEvent

BlockBreakEvent(is_async: bool = False)

Bases: BlockEvent, Cancellable

Called when a block is broken by a player.

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

Attributes:

Name Type Description
player Player

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

player property

player: Player

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

BlockCookEvent

BlockCookEvent(is_async: bool = False)

Bases: BlockEvent, Cancellable

Called when an ItemStack is successfully cooked in a block.

Attributes:

Name Type Description
result ItemStack

The resultant ItemStack for this event.

source ItemStack

The smelted (source) ItemStack for this event.

result property writable

result: ItemStack

The resultant ItemStack for this event.

source property

source: ItemStack

The smelted (source) ItemStack for this event.

BlockEvent

BlockEvent(is_async: bool = False)

Bases: Event

Represents an Block-related event.

Attributes:

Name Type Description
block Block

The Block which is involved in this event.

block property

block: Block

The Block which is involved in this event.

BlockExplodeEvent

BlockExplodeEvent(is_async: bool = False)

Bases: BlockEvent, Cancellable

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.

Attributes:

Name Type Description
block_list list[Block]

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

block_list property writable

block_list: list[Block]

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

BlockFormEvent

BlockFormEvent(is_async: bool = False)

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 Block Form event is cancelled, the block will not be formed.

BlockFromToEvent

BlockFromToEvent(is_async: bool = False)

Bases: BlockEvent, Cancellable

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).

Attributes:

Name Type Description
to_block Block

The faced Block.

to_block property

to_block: Block

The faced Block.

BlockGrowEvent

BlockGrowEvent(is_async: bool = False)

Bases: BlockEvent, Cancellable

Called when a block grows naturally in the world.

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

Attributes:

Name Type Description
new_state BlockState

The new state of the block after it has grown.

new_state property

new_state: BlockState

The new state of the block after it has grown.

BlockPistonEvent

BlockPistonEvent(is_async: bool = False)

Bases: BlockEvent, Cancellable

Called when a piston block is triggered.

Attributes:

Name Type Description
direction BlockFace

The direction in which the piston will operate.

direction property

direction: BlockFace

The direction in which the piston will operate.

BlockPistonExtendEvent

BlockPistonExtendEvent(is_async: bool = False)

Bases: BlockPistonEvent

Called when a piston extends.

BlockPistonRetractEvent

BlockPistonRetractEvent(is_async: bool = False)

Bases: BlockPistonEvent

Called when a piston retracts.

BlockPlaceEvent

BlockPlaceEvent(is_async: bool = False)

Bases: BlockEvent, Cancellable

Called when a block is placed by a player.

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

Attributes:

Name Type Description
block_against Block

The block that the new block was placed against.

block_placed Block

The Block that was placed.

block_replaced_state BlockState

The BlockState of the block that was replaced.

player Player

The Player who placed the block involved in this event.

block_against property

block_against: Block

The block that the new block was placed against.

block_placed property

block_placed: Block

The Block that was placed.

block_replaced_state property

block_replaced_state: BlockState

The BlockState of the block that was replaced.

player property

player: Player

The Player who placed the block involved in this event.

BroadcastMessageEvent

BroadcastMessageEvent(is_async: bool = False)

Bases: ServerEvent, Cancellable

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

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

Attributes:

Name Type Description
message str | Translatable

The message to broadcast.

recipients set[CommandSender]

The set of CommandSenders who will see this broadcast message.

message property writable

message: str | Translatable

The message to broadcast.

recipients property

recipients: set[CommandSender]

The set of CommandSenders who will see this broadcast message.

Cancellable

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

Methods:

Name Description
cancel

Cancel this event.

Attributes:

Name Type Description
is_cancelled bool

Gets or sets the cancellation state of this event.

is_cancelled property writable

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

ChunkEvent(is_async: bool = False)

Bases: DimensionEvent

Represents a Chunk related event.

Attributes:

Name Type Description
chunk Chunk

The Chunk being loaded/unloaded.

chunk property

chunk: Chunk

The Chunk being loaded/unloaded.

ChunkLoadEvent

ChunkLoadEvent(is_async: bool = False)

Bases: ChunkEvent

Called when a chunk is loaded.

ChunkUnloadEvent

ChunkUnloadEvent(is_async: bool = False)

Bases: ChunkEvent

Called when a chunk is unloaded.

DimensionEvent

DimensionEvent(is_async: bool = False)

Bases: LevelEvent

Represents events within a dimension.

Attributes:

Name Type Description
dimension Dimension

The Dimension primarily involved with this event.

dimension property

dimension: Dimension

The Dimension primarily involved with this event.

Event

Event(is_async: bool = False)

Represents an event.

Attributes:

Name Type Description
event_name str

A user-friendly identifier for this event.

is_asynchronous bool

False by default, True if the event fires asynchronously.

event_name property

event_name: str

A user-friendly identifier for this event.

is_asynchronous property

is_asynchronous: bool

False by default, True if the event fires asynchronously.

EventPriority

Bases: IntEnum

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

Attributes:

Name Type Description
HIGH

Event call is of high importance

HIGHEST

Event call is critical and must have the final say in what happens to the event

LOW

Event call is of low importance

LOWEST

Event call is of very low importance and should be run first, to allow other plugins to further customise the outcome

MONITOR

Event is listened to purely for monitoring the outcome of an event. No modifications to the event should be made under this priority.

NORMAL

Event call is neither important nor unimportant, and may be run normally

HIGH class-attribute instance-attribute

HIGH = 3

Event call is of high importance

HIGHEST class-attribute instance-attribute

HIGHEST = 4

Event call is critical and must have the final say in what happens to the event

LOW class-attribute instance-attribute

LOW = 1

Event call is of low importance

LOWEST class-attribute instance-attribute

LOWEST = 0

Event call is of very low importance and should be run first, to allow other plugins to further customise the outcome

MONITOR class-attribute instance-attribute

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.

NORMAL class-attribute instance-attribute

NORMAL = 2

Event call is neither important nor unimportant, and may be run normally

EventResult

Bases: Enum

Represents the result a plugin can apply to an event whose default behaviour can be allowed, denied, or left to the server.

Attributes:

Name Type Description
ALLOW
DEFAULT
DENY

ALLOW class-attribute instance-attribute

ALLOW = 2

DEFAULT class-attribute instance-attribute

DEFAULT = 1

DENY class-attribute instance-attribute

DENY = 0

LeavesDecayEvent

LeavesDecayEvent(is_async: bool = False)

Bases: BlockEvent, Cancellable

Called when leaves are decaying naturally.

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

LevelEvent

LevelEvent(is_async: bool = False)

Bases: Event

Represents events within a level.

Attributes:

Name Type Description
level Level

The Level primarily involved with this event.

level property

level: Level

The Level primarily involved with this event.

MapInitializeEvent

MapInitializeEvent(is_async: bool = False)

Bases: ServerEvent

Called when a map is initialized.

Attributes:

Name Type Description
map MapView

The Map initialized in this event.

map property

map: MapView

The Map initialized in this event.

MobEvent

MobEvent(is_async: bool = False)

Bases: Event

Represents an Mob-related event.

Attributes:

Name Type Description
actor Mob

The Mob which is involved in this event.

actor property

actor: Mob

The Mob which is involved in this event.

PacketReceiveEvent

PacketReceiveEvent(is_async: bool = False)

Bases: ServerEvent, Cancellable

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

Attributes:

Name Type Description
address SocketAddress

The network address of the client that sent this packet.

packet_id int

The ID of the packet.

payload bytes

The raw packet data, excluding the header.

player Player

The Player who is involved in this event.

sub_client_id int

The SubClient ID.

address property

address: SocketAddress

The network address of the client that sent this packet.

packet_id property

packet_id: int

The ID of the packet.

payload property writable

payload: bytes

The raw packet data, excluding the header.

player property

player: Player

The Player who is involved in this event.

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

sub_client_id property

sub_client_id: int

The SubClient ID.

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

PacketSendEvent

PacketSendEvent(is_async: bool = False)

Bases: ServerEvent, Cancellable

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

Attributes:

Name Type Description
address SocketAddress

The network address to which this packet is being sent.

packet_id int

The ID of the packet.

payload bytes

The raw packet data, excluding the header.

player Player

The Player who is involved in this event.

sub_client_id int

The SubClient ID.

address property

address: SocketAddress

The network address to which this packet is being sent.

packet_id property

packet_id: int

The ID of the packet.

payload property writable

payload: bytes

The raw packet data, excluding the header.

player property

player: Player

The Player who is involved in this event.

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

sub_client_id property

sub_client_id: int

The SubClient ID.

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

PlayerBedEnterEvent

PlayerBedEnterEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

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

Attributes:

Name Type Description
bed Block

The bed block involved in this event.

bed property

bed: Block

The bed block involved in this event.

PlayerBedLeaveEvent

PlayerBedLeaveEvent(is_async: bool = False)

Bases: PlayerEvent

Called when a player is leaving a bed.

Attributes:

Name Type Description
bed Block

The bed block involved in this event.

bed property

bed: Block

The bed block involved in this event.

PlayerChatEvent

PlayerChatEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

Called when a player sends a chat message.

Attributes:

Name Type Description
format str

The format to use to display this chat message.

message str

The message that the player is attempting to send.

player Player

The player that this message will be displayed as being sent by.

recipients list[Player]

The set of Players who will see this chat message.

format property writable

format: str

The format to use to display this chat message.

See the format string syntax at https://en.cppreference.com/w/cpp/utility/format/spec.html.

message property writable

message: str

The message that the player is attempting to send.

player property writable

player: Player

The player that this message will be displayed as being sent by.

recipients property

recipients: list[Player]

The set of Players who will see this chat message.

PlayerCommandEvent

PlayerCommandEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

Called whenever a player runs a command.

Attributes:

Name Type Description
command str

The command that the player is attempting to send.

command property writable

command: str

The command that the player is attempting to send.

PlayerDeathEvent

PlayerDeathEvent(is_async: bool = False)

Bases: ActorDeathEvent

Called when a Player dies.

Attributes:

Name Type Description
death_message str | Translatable | None

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

player Player

The Player which is involved in this event.

death_message property writable

death_message: str | Translatable | None

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

player property

player: Player

The Player which is involved in this event.

PlayerDimensionChangeEvent

PlayerDimensionChangeEvent(is_async: bool = False)

Bases: PlayerEvent

Called when a player switches to another dimension.

Attributes:

Name Type Description
from_dimension Dimension

The player's previous dimension.

to_dimension Dimension

The player's new dimension.

from_dimension property

from_dimension: Dimension

The player's previous dimension.

to_dimension property

to_dimension: Dimension

The player's new dimension.

PlayerDropItemEvent

PlayerDropItemEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

Called when a player drops an item from their inventory.

Attributes:

Name Type Description
item ItemStack

The ItemStack dropped by the player.

item property

item: ItemStack

The ItemStack dropped by the player.

PlayerEmoteEvent

PlayerEmoteEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

Called when a player uses an emote.

Attributes:

Name Type Description
emote_id str

The emote piece ID.

is_muted bool

The muted state for the emote.

emote_id property

emote_id: str

The emote piece ID.

is_muted property writable

is_muted: bool

The muted state for the emote.

When True, the emote is executed without sending a chat message about the emote.

PlayerEvent

PlayerEvent(is_async: bool = False)

Bases: Event

Represents a player related event.

Attributes:

Name Type Description
player Player

The Player who is involved in this event.

player property

player: Player

The Player who is involved in this event.

PlayerGameModeChangeEvent

PlayerGameModeChangeEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

Called when the GameMode of the player is changed.

Attributes:

Name Type Description
new_game_mode GameMode

The GameMode the player is switched to.

new_game_mode property

new_game_mode: GameMode

The GameMode the player is switched to.

PlayerInteractActorEvent

PlayerInteractActorEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

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

Attributes:

Name Type Description
actor Actor

The actor that was right-clicked by the player.

actor property

actor: Actor

The actor that was right-clicked by the player.

PlayerInteractEvent

PlayerInteractEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

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

Classes:

Name Description
Action

Represents the type of interaction that triggered this event.

Attributes:

Name Type Description
LEFT_CLICK_AIR
LEFT_CLICK_BLOCK
RIGHT_CLICK_AIR
RIGHT_CLICK_BLOCK
action Action

The action type of this interaction.

block Block

The block clicked with this item.

block_face BlockFace

The face of the block that was clicked.

clicked_position Vector | None

The exact position on the block the player interacted with.

has_block bool

True if this event involved a block.

has_item bool

True if this event involved an item.

item ItemStack | None

The item in hand represented by this event, or None if no item.

LEFT_CLICK_AIR class-attribute instance-attribute

LEFT_CLICK_AIR = LEFT_CLICK_AIR

LEFT_CLICK_BLOCK class-attribute instance-attribute

LEFT_CLICK_BLOCK = LEFT_CLICK_BLOCK

RIGHT_CLICK_AIR class-attribute instance-attribute

RIGHT_CLICK_AIR = RIGHT_CLICK_AIR

RIGHT_CLICK_BLOCK class-attribute instance-attribute

RIGHT_CLICK_BLOCK = RIGHT_CLICK_BLOCK

action property

action: Action

The action type of this interaction.

block property

block: Block

The block clicked with this item.

block_face property

block_face: BlockFace

The face of the block that was clicked.

clicked_position property

clicked_position: Vector | None

The exact position on the block the player interacted with.

This will be None outside of Action.RIGHT_CLICK_BLOCK. All vector components are between 0.0 and 1.0 inclusive.

has_block property

has_block: bool

True if this event involved a block.

has_item property

has_item: bool

True if this event involved an item.

item property

item: ItemStack | None

The item in hand represented by this event, or None if no item.

Action

Bases: Enum

Represents the type of interaction that triggered this event.

Attributes:

Name Type Description
LEFT_CLICK_AIR
LEFT_CLICK_BLOCK
RIGHT_CLICK_AIR
RIGHT_CLICK_BLOCK
LEFT_CLICK_AIR class-attribute instance-attribute
LEFT_CLICK_AIR = 2
LEFT_CLICK_BLOCK class-attribute instance-attribute
LEFT_CLICK_BLOCK = 0
RIGHT_CLICK_AIR class-attribute instance-attribute
RIGHT_CLICK_AIR = 3
RIGHT_CLICK_BLOCK class-attribute instance-attribute
RIGHT_CLICK_BLOCK = 1

PlayerItemConsumeEvent

PlayerItemConsumeEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

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

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.

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

Attributes:

Name Type Description
hand EquipmentSlot

The hand used to consume the item.

item ItemStack

An ItemStack for the item being consumed.

hand property

The hand used to consume the item.

item property

item: ItemStack

An ItemStack for the item being consumed.

PlayerItemHeldEvent

PlayerItemHeldEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

Called when a player changes their currently held item.

Attributes:

Name Type Description
new_slot int

The new held slot index.

previous_slot int

The previous held slot index.

new_slot property

new_slot: int

The new held slot index.

previous_slot property

previous_slot: int

The previous held slot index.

PlayerJoinEvent

PlayerJoinEvent(is_async: bool = False)

Bases: PlayerEvent

Called when a player joins a server.

Attributes:

Name Type Description
join_message str | Translatable | None

The join message to send to all online players.

join_message property writable

join_message: str | Translatable | None

The join message to send to all online players.

PlayerJumpEvent

PlayerJumpEvent(is_async: bool = False)

Bases: PlayerMoveEvent

Called when a player jumps.

PlayerKickEvent

PlayerKickEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

Called when a player gets kicked from the server.

Attributes:

Name Type Description
reason str

The reason why the player is getting kicked.

reason property writable

reason: str

The reason why the player is getting kicked.

PlayerLoginEvent

PlayerLoginEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

Called when a player attempts to login in.

Attributes:

Name Type Description
kick_message str

The kick message to display if the event is cancelled.

kick_message property writable

kick_message: str

The kick message to display if the event is cancelled.

PlayerMoveEvent

PlayerMoveEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

Called when a player moves.

Attributes:

Name Type Description
from_location Location

The location that this player moved from.

to_location Location

The location that this player moved to.

from_location property writable

from_location: Location

The location that this player moved from.

to_location property writable

to_location: Location

The location that this player moved to.

PlayerPickupItemEvent

PlayerPickupItemEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

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

Attributes:

Name Type Description
item Item

The Item picked up by the entity.

item property

item: Item

The Item picked up by the entity.

PlayerPortalEvent

PlayerPortalEvent(is_async: bool = False)

Bases: PlayerTeleportEvent

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

PlayerQuitEvent

PlayerQuitEvent(is_async: bool = False)

Bases: PlayerEvent

Called when a player leaves a server.

Attributes:

Name Type Description
quit_message str | Translatable | None

The quit message to send to all online players.

quit_message property writable

quit_message: str | Translatable | None

The quit message to send to all online players.

PlayerRespawnEvent

PlayerRespawnEvent(is_async: bool = False)

Bases: PlayerEvent

Called when a player respawns.

Classes:

Name Description
RespawnReason

An enum to specify the reason a respawn occurred.

Attributes:

Name Type Description
DEATH
END_PORTAL
respawn_reason RespawnReason

The reason this respawn occurred.

DEATH class-attribute instance-attribute

DEATH = DEATH

END_PORTAL class-attribute instance-attribute

END_PORTAL = END_PORTAL

respawn_reason property

respawn_reason: RespawnReason

The reason this respawn occurred.

RespawnReason

Bases: Enum

An enum to specify the reason a respawn occurred.

Attributes:

Name Type Description
DEATH
END_PORTAL
DEATH class-attribute instance-attribute
DEATH = 0
END_PORTAL class-attribute instance-attribute
END_PORTAL = 1

PlayerSkinChangeEvent

PlayerSkinChangeEvent(is_async: bool = False)

Bases: PlayerEvent, Cancellable

Called when a player changes their skin.

Attributes:

Name Type Description
new_skin Skin

The skin that will be applied.

skin_change_message str | Translatable | None

The message to send to all online players for this skin change.

new_skin property

new_skin: Skin

The skin that will be applied.

skin_change_message property writable

skin_change_message: str | Translatable | None

The message to send to all online players for this skin change.

PlayerTeleportEvent

PlayerTeleportEvent(is_async: bool = False)

Bases: PlayerMoveEvent

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

PluginDisableEvent

PluginDisableEvent(is_async: bool = False)

Bases: ServerEvent

Called when a plugin is disabled.

Attributes:

Name Type Description
plugin Plugin

The Plugin involved in this event.

plugin property

plugin: Plugin

The Plugin involved in this event.

PluginEnableEvent

PluginEnableEvent(is_async: bool = False)

Bases: ServerEvent

Called when a plugin is enabled.

Attributes:

Name Type Description
plugin Plugin

The Plugin involved in this event.

plugin property

plugin: Plugin

The Plugin involved in this event.

ScriptMessageEvent

ScriptMessageEvent(is_async: bool = False)

Bases: ServerEvent, Cancellable

Called when a message is sent by the /scriptevent command.

Attributes:

Name Type Description
message str

The message to send.

message_id str

The message id to send.

sender CommandSender

The command sender who sent the script message.

message property

message: str

The message to send.

message_id property

message_id: str

The message id to send.

sender property

sender: CommandSender

The command sender who sent the script message.

ServerCommandEvent

ServerCommandEvent(is_async: bool = False)

Bases: ServerEvent, Cancellable

Called when a command is run by a non-player, early in the command handling 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.

Attributes:

Name Type Description
command str

The command that the server is attempting to execute from the console.

sender CommandSender

The command sender.

command property writable

command: str

The command that the server is attempting to execute from the console.

sender property

sender: CommandSender

The command sender.

ServerEvent

ServerEvent(is_async: bool = False)

Bases: Event

Represents a Server-related event.

ServerListPingEvent

ServerListPingEvent(is_async: bool = False)

Bases: ServerEvent, Cancellable

Called when a server ping is coming in.

Attributes:

Name Type Description
address SocketAddress

The address the ping is coming from.

game_mode GameMode

The current game mode.

level_name str

The level name.

local_port int

The local port of the server.

local_port_v6 int

The local port of the server for IPv6 support.

max_players int

The maximum number of players allowed.

minecraft_version_network str

The network version of Minecraft that is supported by this server.

motd str

The message of the day.

network_protocol_version int

The network protocol version of this server.

num_players int

The number of players online.

server_guid str

The unique identifier of the server.

address property

address: SocketAddress

The address the ping is coming from.

game_mode property writable

game_mode: GameMode

The current game mode.

level_name property writable

level_name: str

The level name.

local_port property writable

local_port: int

The local port of the server.

local_port_v6 property writable

local_port_v6: int

The local port of the server for IPv6 support.

max_players property writable

max_players: int

The maximum number of players allowed.

minecraft_version_network property writable

minecraft_version_network: str

The network version of Minecraft that is supported by this server.

motd property writable

motd: str

The message of the day.

network_protocol_version property

network_protocol_version: int

The network protocol version of this server.

num_players property writable

num_players: int

The number of players online.

server_guid property writable

server_guid: str

The unique identifier of the server.

ServerLoadEvent

ServerLoadEvent(is_async: bool = False)

Bases: Event

Called when either the server startup or reload has completed.

Classes:

Name Description
LoadType

Represents the context in which the server was loaded.

Attributes:

Name Type Description
STARTUP
type LoadType

The load type of this event.

STARTUP class-attribute instance-attribute

STARTUP = STARTUP

type property

type: LoadType

The load type of this event.

LoadType

Bases: Enum

Represents the context in which the server was loaded.

Attributes:

Name Type Description
STARTUP
STARTUP class-attribute instance-attribute
STARTUP = 0

ThunderChangeEvent

ThunderChangeEvent(is_async: bool = False)

Bases: WeatherEvent, Cancellable

Called when the thunder state in a world is changing.

Attributes:

Name Type Description
to_thunder_state bool

True if the weather is being set to thundering, False otherwise.

to_thunder_state property

to_thunder_state: bool

True if the weather is being set to thundering, False otherwise.

WeatherChangeEvent

WeatherChangeEvent(is_async: bool = False)

Bases: WeatherEvent, Cancellable

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

Attributes:

Name Type Description
to_weather_state bool

True if the weather is being set to raining, False otherwise.

to_weather_state property

to_weather_state: bool

True if the weather is being set to raining, False otherwise.

WeatherEvent

WeatherEvent(is_async: bool = False)

Bases: Event

Represents a Weather-related event.

Attributes:

Name Type Description
level Level

The Level where this event is occurring.

level property

level: Level

The Level where this event is occurring.

event_handler

event_handler(__func: _F) -> _F
event_handler(
    *,
    priority: EventPriority = ...,
    ignore_cancelled: bool = ...
) -> Callable[[_F], _F]