Event
endstone.event
¶
Classes relating to handling triggered code executions.
Classes:
| Name | Description |
|---|---|
ActorChangeBlockEvent |
Called when an |
ActorCollideWithActorEvent |
Called when two actors collide with each other. |
ActorDamageEvent |
Called when an |
ActorDeathEvent |
Called when an |
ActorDismountEvent |
Called when an |
ActorEffectEvent |
Called when an effect on a |
ActorEvent |
Represents an |
ActorExplodeEvent |
Called when an actor explodes. |
ActorKnockbackEvent |
Called when a living entity receives knockback. |
ActorPickupItemEvent |
Called when an |
ActorRemoveEvent |
Called when an |
ActorSpawnEvent |
Called when an |
ActorTeleportEvent |
Called when a non-player entity is teleported from one location to another. |
ActorToggleGlideEvent |
Called when an |
ActorToggleSwimEvent |
Called when an |
BlockBreakEvent |
Called when a block is broken by a player. |
BlockCookEvent |
Called when an |
BlockEvent |
Represents an |
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 |
Cancellable |
Represents an event that may be cancelled by a plugin or the server. |
CauldronLevelChangeEvent |
Called when a cauldron's level or contents change. |
ChunkEvent |
Represents a |
ChunkLoadEvent |
Called when a chunk is loaded. |
ChunkUnloadEvent |
Called when a chunk is unloaded. |
DimensionEvent |
Represents events within a dimension. |
DimensionLoadEvent |
Called when a dimension is loaded. |
EnchantItemEvent |
Called when a player enchants an item at an enchanting table. |
Event |
Represents an event. |
EventPriority |
Listeners are called in following order: |
EventResult |
Represents the result a plugin can apply to an event whose default behaviour can be allowed, denied, or left to the server. |
InventoryCloseEvent |
Called when a player closes an inventory. |
InventoryEvent |
Represents a player related inventory event. |
InventoryInteractEvent |
An abstract base class for events that describe an interaction between a |
InventoryOpenEvent |
Called when a player opens an inventory. |
LeavesDecayEvent |
Called when leaves are decaying naturally. |
LevelEvent |
Represents events within a level. |
MapInitializeEvent |
Called when a map is initialized. |
MobEvent |
Represents an |
PacketReceiveEvent |
Called when the server receives a packet from a connected client. |
PacketSendEvent |
Called when the server sends a packet to a connected client. |
PlayerArmSwingEvent |
Called when a player swings their arm. |
PlayerArmorStandManipulateEvent |
Called when a player interacts with an armor stand and will either swap, retrieve or place an item. |
PlayerBedEnterEvent |
Called when a player is almost about to enter the bed. |
PlayerBedLeaveEvent |
Called when a player is leaving a bed. |
PlayerBucketActorEvent |
Called when a player captures an actor in a bucket. |
PlayerBucketEmptyEvent |
Called when a player empties a bucket. |
PlayerBucketEvent |
Base class for events involving a player's bucket interaction. |
PlayerBucketFillEvent |
Called when a player fills a bucket. |
PlayerChatEvent |
Called when a player sends a chat message. |
PlayerCommandEvent |
Called whenever a player runs a command. |
PlayerCraftItemEvent |
Called when a player crafts an item, either inside a crafting grid or straight from the recipe book. |
PlayerDeathEvent |
Called when a |
PlayerDimensionChangeEvent |
Called when a player switches to another dimension. |
PlayerDropItemEvent |
Called when a player drops an item from their inventory. |
PlayerEditBookEvent |
Called when a player edits or signs a book. |
PlayerEmoteEvent |
Called when a player uses an emote. |
PlayerEvent |
Represents a player related event. |
PlayerExpChangeEvent |
Called when a player's experience changes. |
PlayerGameModeChangeEvent |
Called when the |
PlayerHideActorEvent |
Called when a visible actor is hidden from a player. |
PlayerInputEvent |
Called when a player sends updated input to the server. |
PlayerInteractActorEvent |
Called when a player right-clicks an actor. |
PlayerInteractEvent |
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. |
PlayerLevelChangeEvent |
Called when a player's level changes. |
PlayerLoginEvent |
Called when a player attempts to login in. |
PlayerMoveEvent |
Called when a player moves. |
PlayerOpenSignEvent |
Called when a player begins editing a sign's text. |
PlayerPickupArrowEvent |
Called when a player picks up an arrow or a thrown trident from the ground. |
PlayerPickupExperienceEvent |
Called when a player picks up an experience orb. |
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. |
PlayerRecipeBookSettingsChangeEvent |
Called when a player changes recipe book settings. |
PlayerRespawnEvent |
Called when a player respawns. |
PlayerRiptideEvent |
Called when a player activates the riptide enchantment, using their trident to propel them through the air. |
PlayerSetSpawnEvent |
Called when a player's spawn is set, either by themselves or otherwise. |
PlayerShearActorEvent |
Called when a player shears an actor. |
PlayerShowActorEvent |
Called when a hidden actor is shown to a player. |
PlayerSkinChangeEvent |
Called when a player changes their skin. |
PlayerTeleportEvent |
Called when a player is teleported from one location to another. |
PlayerToggleCrawlEvent |
Called when a player toggles their crawling state. |
PlayerToggleFlightEvent |
Called when a player toggles their flying state. |
PlayerToggleSneakEvent |
Called when a player toggles their sneaking state. |
PlayerToggleSprintEvent |
Called when a player toggles their sprinting state. |
PluginDisableEvent |
Called when a plugin is disabled. |
PluginEnableEvent |
Called when a plugin is enabled. |
ScriptMessageEvent |
Called when a message is sent by the |
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. |
UnknownCommandEvent |
Called when a command sender executes a command that is not defined. |
WeatherChangeEvent |
Called when the weather (rain) state in a world is changing. |
WeatherEvent |
Represents a Weather-related event. |
Functions:
| Name | Description |
|---|---|
event_handler |
|
ActorChangeBlockEvent
¶
ActorChangeBlockEvent(is_async: bool = False)
Bases: ActorEvent, Cancellable
Called when an Actor changes a block through its own behaviour, such as a creeper exploding, an
enderman picking a block up, a ravager trampling crops or a zombie breaking a door.
Unlike Bukkit's equivalent, this covers only the mob griefing paths. It is not called for falling blocks landing or for sheep eating grass, and the resulting block state is not available.
Attributes:
| Name | Type | Description |
|---|---|---|
block |
Block
|
The block that will be changed. |
ActorCollideWithActorEvent
¶
ActorCollideWithActorEvent(is_async: bool = False)
Bases: Event, Cancellable
Called when two actors collide with each other.
If this event is cancelled, the actors will not be pushed away from each other. Cancelling also stops either actor from being pulled onto the other when the other is a rideable vehicle, so a listener that cancels every collision also stops boats and minecarts from being boarded by walking into them.
The server fires this before it decides whether the collision leads to a push, so it is also called for pairs the server then leaves alone, and it is called more than once per tick for a pair that keeps overlapping.
Attributes:
| Name | Type | Description |
|---|---|---|
actors |
list[Actor]
|
The actors that are involved in this event. |
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 |
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 |
damage_source
property
¶
damage_source: DamageSource
A DamageSource detailing the source of the damage for the death.
ActorDismountEvent
¶
ActorDismountEvent(is_async: bool = False)
Bases: ActorEvent, Cancellable
Called when an Actor stops riding another Actor.
Attributes:
| Name | Type | Description |
|---|---|---|
vehicle |
Actor
|
The actor that is being dismounted. |
ActorEffectEvent
¶
ActorEffectEvent(is_async: bool = False)
Bases: MobEvent, Cancellable
Called when an effect on a Mob changes.
This is fired before the change is applied. Cancelling the event prevents it, and the effect may be
replaced with a different one by assigning to effect.
Classes:
| Name | Description |
|---|---|
Action |
An enum to specify how the effect changed. |
Attributes:
| Name | Type | Description |
|---|---|---|
ADDED |
|
|
action |
Action
|
How the effect changed. |
effect |
Effect
|
The effect 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
¶
The list of blocks that would have been removed or were removed from the explosion event.
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 | None
|
The source actor that has caused knockback to the defender, or |
ActorPickupItemEvent
¶
ActorPickupItemEvent(is_async: bool = False)
Bases: ActorEvent, Cancellable
Called when an Actor picks an item up from the ground.
This is not called for players; see PlayerPickupItemEvent instead.
Attributes:
| Name | Type | Description |
|---|---|---|
amount |
int
|
The number of items that will be picked up from the stack. |
item |
Item
|
The Item picked up by the 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. |
ActorToggleGlideEvent
¶
ActorToggleGlideEvent(is_async: bool = False)
Bases: MobEvent
Called when an Actor's gliding state is toggled with an elytra.
Attributes:
| Name | Type | Description |
|---|---|---|
is_gliding |
bool
|
Whether the actor is now gliding or not. |
ActorToggleSwimEvent
¶
ActorToggleSwimEvent(is_async: bool = False)
Bases: MobEvent
Called when an Actor's swimming state is toggled.
Attributes:
| Name | Type | Description |
|---|---|---|
is_swimming |
bool
|
Whether the actor is now swimming or not. |
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 |
BlockCookEvent
¶
BlockCookEvent(is_async: bool = False)
Bases: BlockEvent, Cancellable
Called when an ItemStack is successfully cooked in a block.
Attributes:
| Name | Type | Description |
|---|---|---|
recipe |
CookingRecipe | None
|
The cooking recipe this event is for, or |
result |
ItemStack
|
The resultant |
source |
ItemStack
|
The smelted (source) |
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. |
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 |
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. |
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. |
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_replaced_state |
BlockState
|
The |
player |
Player
|
The |
block_replaced_state
property
¶
block_replaced_state: BlockState
The BlockState of the block that was replaced.
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 |
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 this event.
A cancelled event will not be executed in the server, but will still pass to other plugins.
CauldronLevelChangeEvent
¶
CauldronLevelChangeEvent(is_async: bool = False)
Bases: BlockEvent, Cancellable
Called when a cauldron's level or contents change.
Classes:
| Name | Description |
|---|---|
ChangeReason |
The reason the cauldron changed. |
Attributes:
| Name | Type | Description |
|---|---|---|
ARMOR_WASH |
|
|
BANNER_WASH |
|
|
BOTTLE_EMPTY |
|
|
BOTTLE_FILL |
|
|
BUCKET_EMPTY |
|
|
BUCKET_FILL |
|
|
EVAPORATE |
|
|
EXTINGUISH |
|
|
NATURAL_FILL |
|
|
SHULKER_WASH |
|
|
UNKNOWN |
|
|
actor |
Actor | None
|
The actor which did this, or |
new_state |
BlockState
|
The state the cauldron will take. |
reason |
ChangeReason
|
The reason for the change. |
actor
property
¶
actor: Actor | None
The actor which did this, or None.
Only a player interacting with the cauldron is reported. Every other change reports None.
new_state
property
¶
new_state: BlockState
The state the cauldron will take.
Modifying the returned state changes what the cauldron becomes.
reason
property
¶
reason: ChangeReason
The reason for the change.
Only a player interacting with the cauldron is attributed. Every other change reports
ChangeReason.UNKNOWN.
ChangeReason
¶
Bases: Enum
The reason the cauldron changed.
Attributes:
| Name | Type | Description |
|---|---|---|
ARMOR_WASH |
|
|
BANNER_WASH |
|
|
BOTTLE_EMPTY |
|
|
BOTTLE_FILL |
|
|
BUCKET_EMPTY |
|
|
BUCKET_FILL |
|
|
EVAPORATE |
|
|
EXTINGUISH |
|
|
NATURAL_FILL |
|
|
SHULKER_WASH |
|
|
UNKNOWN |
|
ChunkEvent
¶
ChunkEvent(is_async: bool = False)
Bases: DimensionEvent
Represents a Chunk related event.
Attributes:
| Name | Type | Description |
|---|---|---|
chunk |
Chunk
|
The |
DimensionEvent
¶
DimensionEvent(is_async: bool = False)
Bases: LevelEvent
Represents events within a dimension.
Attributes:
| Name | Type | Description |
|---|---|---|
dimension |
Dimension
|
The |
EnchantItemEvent
¶
EnchantItemEvent(is_async: bool = False)
Bases: InventoryEvent, Cancellable
Called when a player enchants an item at an enchanting table.
Cancelling the event leaves the item, the player's experience levels and the lapis lazuli untouched.
Bedrock does not reveal a single hinted enchantment for an offer, so every enchantment the offer applies is
listed in enchants_to_add.
Attributes:
| Name | Type | Description |
|---|---|---|
enchant_block |
Block
|
The enchanting table involved in this event. |
enchanter |
Player
|
The player enchanting the item. |
enchants_to_add |
dict[Enchantment, int]
|
A copy of the enchantments and levels that will be applied; assign it back after changes. |
exp_level_cost |
int
|
The minimum player level required by the selected option. |
item |
ItemStack
|
The item that will be enchanted. |
which_button |
int
|
The selected enchanting button, from 0 to 2. |
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
|
|
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 |
HIGHEST
class-attribute
instance-attribute
¶
Event call is critical and must have the final say in what happens to the event
LOWEST
class-attribute
instance-attribute
¶
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
¶
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
¶
Event call is neither important nor unimportant, and may be run normally
EventResult
¶
InventoryCloseEvent
¶
InventoryCloseEvent(is_async: bool = False)
Bases: InventoryEvent
Called when a player closes an inventory.
Attributes:
| Name | Type | Description |
|---|---|---|
player |
Player
|
The player who is closing the inventory. |
InventoryInteractEvent
¶
InventoryInteractEvent(is_async: bool = False)
Bases: InventoryEvent, Cancellable
An abstract base class for events that describe an interaction between a Player and the contents of an
Inventory.
Attributes:
| Name | Type | Description |
|---|---|---|
who_clicked |
Player
|
The player who performed the click. |
InventoryOpenEvent
¶
InventoryOpenEvent(is_async: bool = False)
Bases: InventoryEvent, Cancellable
Called when a player opens an inventory.
If this event is cancelled, the inventory will not be opened and the player will not see the container screen.
Attributes:
| Name | Type | Description |
|---|---|---|
player |
Player
|
The player who is opening the inventory. |
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.
MapInitializeEvent
¶
MapInitializeEvent(is_async: bool = False)
Bases: ServerEvent
Called when a map is initialized.
Attributes:
| Name | Type | Description |
|---|---|---|
map |
MapView
|
The |
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 | None
|
The |
sub_client_id |
int
|
The SubClient ID. |
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 | None
|
The |
sub_client_id |
int
|
The SubClient ID. |
PlayerArmSwingEvent
¶
PlayerArmSwingEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Called when a player swings their arm.
Cancelling stops the server acting on the swing at all. The swing is neither recorded nor shown to the other players in the dimension.
Note
The swinging player still sees their own arm move, because their client plays the animation without waiting for the server. The event covers swings the player starts. Swings the server drives itself, such as dropping an item, do not fire it.
Attributes:
| Name | Type | Description |
|---|---|---|
item |
ItemStack | None
|
The item the player was holding when they swung their arm. |
PlayerArmorStandManipulateEvent
¶
PlayerArmorStandManipulateEvent(is_async: bool = False)
Bases: PlayerInteractActorEvent
Called when a player interacts with an armor stand and will either swap, retrieve or place an item.
Attributes:
| Name | Type | Description |
|---|---|---|
armor_stand_item |
ItemStack
|
The item held by the armor stand in the affected slot. |
player_item |
ItemStack
|
The item held by the player during the interaction. |
slot |
EquipmentSlot
|
The armor stand equipment slot affected by the interaction. |
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. |
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. |
PlayerBucketActorEvent
¶
PlayerBucketActorEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Called when a player captures an actor in a bucket.
Attributes:
| Name | Type | Description |
|---|---|---|
actor |
Actor
|
The actor being captured. |
hand |
EquipmentSlot
|
The hand used to capture the actor. |
original_bucket |
ItemStack
|
The bucket used to capture the actor. |
PlayerBucketEvent
¶
PlayerBucketEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Base class for events involving a player's bucket interaction.
Attributes:
| Name | Type | Description |
|---|---|---|
block |
Block | None
|
The block involved in this event, or |
block_clicked |
Block
|
The block clicked by the player. |
block_face |
BlockFace
|
The face on the clicked block. |
bucket |
ItemType
|
The bucket used in this event. |
hand |
EquipmentSlot
|
The hand used in this event. |
item_stack |
ItemStack | None
|
The resulting item in the player's hand, or |
hand
property
¶
hand: EquipmentSlot
The hand used in this event.
This is always EquipmentSlot.HAND, because Bedrock does not report which hand was used for this interaction.
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 |
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.
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. |
PlayerCraftItemEvent
¶
PlayerCraftItemEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Called when a player crafts an item, either inside a crafting grid or straight from the recipe book.
If the event is cancelled the item will not be crafted and the ingredients will not be consumed.
Attributes:
| Name | Type | Description |
|---|---|---|
ingredients |
list[ItemStack]
|
The ingredients a single craft consumes. |
recipe |
Recipe
|
A copy of the current recipe on the crafting matrix. |
repetitions |
int
|
The number of times the recipe is being crafted. |
results |
list[ItemStack]
|
The items a single craft produces. |
ingredients
property
¶
The ingredients a single craft consumes.
These are the items in the crafting grid where the player used one. Crafting from the recipe book never fills the grid, so the ingredients then come from the recipe instead, and an ingredient that accepts several items reports the one the recipe names rather than the one the player supplied.
repetitions
property
writable
¶
repetitions: int
The number of times the recipe is being crafted.
This is usually 1, but is higher when a batch is crafted at once, such as a shift click in the recipe book.
results
property
writable
¶
The items a single craft produces.
A recipe usually produces one item, but may produce several, and an ingredient that leaves a remainder behind contributes one too. Results are replaced one for one, so any beyond the number the recipe produces are ignored; cancel the event to stop the craft instead.
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 |
death_message
property
writable
¶
death_message: str | Translatable | None
The death message that will appear to everyone on the server.
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. |
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 |
PlayerEditBookEvent
¶
PlayerEditBookEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Called when a player edits or signs a book.
Attributes:
| Name | Type | Description |
|---|---|---|
is_signing |
bool
|
Whether the player is signing the book. |
new_book_meta |
BookMeta
|
The book metadata that the player is attempting to add to the book. |
previous_book_meta |
BookMeta
|
A copy of the book metadata before the edit. |
slot |
int
|
The inventory slot containing the book. |
new_book_meta
property
writable
¶
new_book_meta: BookMeta
The book metadata that the player is attempting to add to the book.
Note
Reading this gives a copy: assign to it to change what will actually be added to the book.
A title, an author and a generation are only written when the book is being signed. On a plain edit the book
stays a book and quill, which holds none of them, and they are dropped. See is_signing.
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. |
PlayerExpChangeEvent
¶
PlayerExpChangeEvent(is_async: bool = False)
Bases: PlayerEvent
Called when a player's experience changes.
Attributes:
| Name | Type | Description |
|---|---|---|
amount |
int
|
The amount of experience the player will be given. |
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 |
PlayerHideActorEvent
¶
PlayerHideActorEvent(is_async: bool = False)
Bases: PlayerEvent
Called when a visible actor is hidden from a player.
This event is only called when the actor's visibility status is actually changed. It is called regardless of whether the actor is within the player's tracking range.
Attributes:
| Name | Type | Description |
|---|---|---|
actor |
Actor
|
The actor hidden from the player. |
PlayerInputEvent
¶
PlayerInputEvent(is_async: bool = False)
Bases: PlayerEvent
Called when a player sends updated input to the server.
Attributes:
| Name | Type | Description |
|---|---|---|
input |
Input
|
The new input received from this player. |
PlayerInteractActorEvent
¶
PlayerInteractActorEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Called when a player right-clicks an actor.
Attributes:
| Name | Type | Description |
|---|---|---|
actor |
Actor
|
The actor that was right-clicked by the player. |
PlayerInteractEvent
¶
PlayerInteractEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Called when a player interacts with an object or air.
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 | None
|
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
|
|
has_item |
bool
|
|
item |
ItemStack | None
|
The item in hand represented by this event, or |
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.
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 |
|
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 |
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. |
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.
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. |
PlayerLevelChangeEvent
¶
PlayerLevelChangeEvent(is_async: bool = False)
Bases: PlayerEvent
Called when a player's level changes.
Attributes:
| Name | Type | Description |
|---|---|---|
new_level |
int
|
The player's level after the change. |
old_level |
int
|
The player's level before the change. |
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. |
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. |
PlayerOpenSignEvent
¶
PlayerOpenSignEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Called when a player begins editing a sign's text.
Cancelling this event stops the sign editing menu from opening.
Classes:
| Name | Description |
|---|---|
Cause |
The cause of the sign opening. |
Attributes:
| Name | Type | Description |
|---|---|---|
INTERACT |
|
|
PLACE |
|
|
PLUGIN |
|
|
UNKNOWN |
|
|
cause |
Cause
|
The cause of the sign opening. |
side |
Side
|
The side of the sign being opened. |
sign |
Sign
|
A captured state of the sign involved in this event. |
PlayerPickupArrowEvent
¶
PlayerPickupArrowEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Called when a player picks up an arrow or a thrown trident from the ground.
Attributes:
| Name | Type | Description |
|---|---|---|
arrow |
Actor
|
The arrow picked up by the player. |
PlayerPickupExperienceEvent
¶
PlayerPickupExperienceEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Called when a player picks up an experience orb.
Cancelling the event leaves the orb in the world.
Attributes:
| Name | Type | Description |
|---|---|---|
amount |
int
|
The amount of experience the orb is worth. |
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. |
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.
PlayerRecipeBookSettingsChangeEvent
¶
PlayerRecipeBookSettingsChangeEvent(is_async: bool = False)
Bases: PlayerEvent
Called when a player changes recipe book settings.
Classes:
| Name | Description |
|---|---|
RecipeBookType |
The recipe book type. |
Attributes:
| Name | Type | Description |
|---|---|---|
BLAST_FURNACE |
|
|
CRAFTING |
|
|
FURNACE |
|
|
SMOKER |
|
|
is_filtering |
bool
|
Whether recipe filtering is enabled. |
is_open |
bool
|
Whether the recipe book is open. |
recipe_book_type |
RecipeBookType
|
The type of recipe book whose settings changed. |
recipe_book_type
property
¶
recipe_book_type: RecipeBookType
The type of recipe book whose settings changed.
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. |
PlayerRiptideEvent
¶
PlayerRiptideEvent(is_async: bool = False)
Bases: PlayerEvent
Called when a player activates the riptide enchantment, using their trident to propel them through the air.
The riptide action is currently performed client side, so manipulating the player in this event may have undesired effects.
Attributes:
| Name | Type | Description |
|---|---|---|
item |
ItemStack
|
An |
PlayerSetSpawnEvent
¶
PlayerSetSpawnEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Called when a player's spawn is set, either by themselves or otherwise.
Assigning a new location redirects the spawn that is about to be written; cancelling leaves the respawn point
untouched.
Note
Only the location's block coordinates and dimension are written back; Bedrock does not persist yaw/pitch for
a respawn point. Cancelling stops the respawn point from changing, but not the feedback around it:
/spawnpoint still reports success and a respawn anchor still plays its sound and message, because neither
consults the setter. The event is not fired when Bedrock clears a respawn point, so /clearspawnpoint and
breaking the bed a player is bound to are both silent.
Classes:
| Name | Description |
|---|---|
Cause |
The cause of the spawn change. |
Attributes:
| Name | Type | Description |
|---|---|---|
BED |
|
|
COMMAND |
|
|
PLUGIN |
|
|
RESPAWN_ANCHOR |
|
|
UNKNOWN |
|
|
cause |
Cause
|
The cause of the spawn change. |
location |
Location | None
|
The spawn location, or |
PlayerShearActorEvent
¶
PlayerShearActorEvent(is_async: bool = False)
Bases: PlayerEvent, Cancellable
Called when a player shears an actor.
Attributes:
| Name | Type | Description |
|---|---|---|
actor |
Actor
|
The actor being sheared. |
hand |
EquipmentSlot
|
The hand used to shear the actor. |
item |
ItemStack
|
The shears used. |
PlayerShowActorEvent
¶
PlayerShowActorEvent(is_async: bool = False)
Bases: PlayerEvent
Called when a hidden actor is shown to a player.
This event is only called when the actor's visibility status is actually changed. It is called regardless of whether the actor is within the player's tracking range.
Attributes:
| Name | Type | Description |
|---|---|---|
actor |
Actor
|
The actor shown to the player. |
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. |
skin_change_message
property
writable
¶
skin_change_message: str | Translatable | None
The message to send to all online players for this skin change.
PlayerToggleCrawlEvent
¶
PlayerToggleCrawlEvent(is_async: bool = False)
Bases: PlayerEvent
Called when a player toggles their crawling state.
Attributes:
| Name | Type | Description |
|---|---|---|
is_crawling |
bool
|
Whether the player is now crawling or not. |
PlayerToggleFlightEvent
¶
PlayerToggleFlightEvent(is_async: bool = False)
Bases: PlayerEvent
Called when a player toggles their flying state.
Attributes:
| Name | Type | Description |
|---|---|---|
is_flying |
bool
|
Whether the player is now flying or not. |
PlayerToggleSneakEvent
¶
PlayerToggleSneakEvent(is_async: bool = False)
Bases: PlayerEvent
Called when a player toggles their sneaking state.
Attributes:
| Name | Type | Description |
|---|---|---|
is_sneaking |
bool
|
Whether the player is now sneaking or not. |
PlayerToggleSprintEvent
¶
PlayerToggleSprintEvent(is_async: bool = False)
Bases: PlayerEvent
Called when a player toggles their sprinting state.
Attributes:
| Name | Type | Description |
|---|---|---|
is_sprinting |
bool
|
Whether the player is now sprinting or not. |
PluginDisableEvent
¶
PluginDisableEvent(is_async: bool = False)
Bases: ServerEvent
Called when a plugin is disabled.
Attributes:
| Name | Type | Description |
|---|---|---|
plugin |
Plugin
|
The |
PluginEnableEvent
¶
PluginEnableEvent(is_async: bool = False)
Bases: ServerEvent
Called when a plugin is enabled.
Attributes:
| Name | Type | Description |
|---|---|---|
plugin |
Plugin
|
The |
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. |
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. |
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. |
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. |
ServerLoadEvent
¶
ServerLoadEvent(is_async: bool = False)
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
|
|
UnknownCommandEvent
¶
UnknownCommandEvent(is_async: bool = False)
Bases: Event
Called when a command sender executes a command that is not defined.
Attributes:
| Name | Type | Description |
|---|---|---|
command_line |
str
|
The command that was sent. |
message |
str | Translatable | None
|
The message that will be returned, or |
sender |
CommandSender
|
The command sender. |
message
property
writable
¶
message: str | Translatable | None
The message that will be returned, or None if no message will be sent.
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
|
|
event_handler
¶
event_handler(
*,
priority: EventPriority = ...,
ignore_cancelled: bool = ...
) -> Callable[[_F], _F]