Skip to main content

Module events

Module events 

Source
Expand description

Game events and the event bus.

This module provides both:

Events are dispatched through the bus in three stages:

  1. Validate — read-only checks, can cancel (permissions, anti-cheat)
  2. Process — state mutation (world changes, inventory updates)
  3. Post — side effects (broadcasting, persistence, logging)

If any Validate handler cancels an event, Process and Post are skipped entirely.

Use the macros ([game_cancellable_event!], [game_event!], [instant_cancellable_event!], [instant_event!]) to implement the Event trait for custom event types.

Re-exports§

pub use crate::world::block_entity::BlockEntityKind;

Structs§

BlockBrokenEvent
A player broke a block.
BlockEntityCreatedEvent
Fires AFTER a block entity is created at a position that had none.
BlockEntityDestroyedEvent
Fires AFTER a block entity is removed from the world.
BlockEntityModifiedEvent
Fires AFTER a block entity’s data is modified.
BlockPlacedEvent
A player placed a block.
ChatMessageEvent
A player sent a chat message.
CommandEvent
A player issued a command (e.g., /tp 0 64 0).
ContainerClickEvent
Fires BEFORE a click inside an open container is applied.
ContainerClosedEvent
Fires BEFORE the OpenContainer component is removed from the player.
ContainerDragEvent
Fires BEFORE a drag (paint mode) distribution is applied.
ContainerOpenRequestEvent
Fires BEFORE a container window opens.
ContainerOpenedEvent
Fires AFTER a container window has been opened for a player.
ContainerSlotChangedEvent
Fires AFTER a container slot has changed.
CraftingCraftedEvent
A successful craft has been performed.
CraftingGridChangedEvent
The contents of a crafting grid have changed.
CraftingPreCraftEvent
A player is about to take a crafting result (cancellable).
CraftingRecipeClearedEvent
The current crafting grid no longer matches any recipe.
CraftingRecipeMatchedEvent
A recipe was matched against the current crafting grid contents.
CraftingShiftClickBatchEvent
A shift-click batch craft is about to begin (cancellable).
EventBus
Generic event bus that dispatches events through staged handlers.
PlayerInteractEvent
A player right-clicked on a block.
PlayerJoinedEvent
A new player has joined the server.
PlayerLeftEvent
A player has disconnected from the server.
PlayerMovedEvent
A player moved or changed look direction.
RecipeBookFillRequestEvent
A player is about to auto-fill a recipe from the recipe book (cancellable).
RecipeBookFilledEvent
A player auto-filled a recipe from the recipe book.
RecipeLockedEvent
A recipe has been locked for the current player.
RecipeRegisterEvent
A plugin is about to register a recipe (cancellable).
RecipeRegisteredEvent
A recipe has been registered with the runtime registry.
RecipeUnlockedEvent
A recipe has been unlocked for the current player.
RecipeUnregisteredEvent
A recipe has been removed from the runtime registry.

Enums§

BusKind
Which event bus an event type belongs to.
CloseReason
Why a container window is closing.
ContainerClickType
Mirror of server’s click action that plugins can safely consume.
DragType
Type of drag operation (paint mode).
Stage
Execution stage for event handlers.
WindowSlotKind
Categorises which slot was clicked, independent of window type.

Traits§

Event
Trait implemented by all game events.
EventRouting
Declares which event bus an event type belongs to.