Expand description
Game events and the event bus.
This module provides both:
- The generic event-bus infrastructure (
EventBus,Event,Stage,BusKind,EventRouting) - Domain event types organized by area:
block,chat,container,player, and crafting/recipe events.
Events are dispatched through the bus in three stages:
- Validate — read-only checks, can cancel (permissions, anti-cheat)
- Process — state mutation (world changes, inventory updates)
- 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§
- Block
Broken Event - A player broke a block.
- Block
Entity Created Event - Fires AFTER a block entity is created at a position that had none.
- Block
Entity Destroyed Event - Fires AFTER a block entity is removed from the world.
- Block
Entity Modified Event - Fires AFTER a block entity’s data is modified.
- Block
Placed Event - A player placed a block.
- Chat
Message Event - A player sent a chat message.
- Command
Event - A player issued a command (e.g.,
/tp 0 64 0). - Container
Click Event - Fires BEFORE a click inside an open container is applied.
- Container
Closed Event - Fires BEFORE the
OpenContainercomponent is removed from the player. - Container
Drag Event - Fires BEFORE a drag (paint mode) distribution is applied.
- Container
Open Request Event - Fires BEFORE a container window opens.
- Container
Opened Event - Fires AFTER a container window has been opened for a player.
- Container
Slot Changed Event - Fires AFTER a container slot has changed.
- Crafting
Crafted Event - A successful craft has been performed.
- Crafting
Grid Changed Event - The contents of a crafting grid have changed.
- Crafting
PreCraft Event - A player is about to take a crafting result (cancellable).
- Crafting
Recipe Cleared Event - The current crafting grid no longer matches any recipe.
- Crafting
Recipe Matched Event - A recipe was matched against the current crafting grid contents.
- Crafting
Shift Click Batch Event - A shift-click batch craft is about to begin (cancellable).
- Event
Bus - Generic event bus that dispatches events through staged handlers.
- Player
Interact Event - A player right-clicked on a block.
- Player
Joined Event - A new player has joined the server.
- Player
Left Event - A player has disconnected from the server.
- Player
Moved Event - A player moved or changed look direction.
- Recipe
Book Fill Request Event - A player is about to auto-fill a recipe from the recipe book (cancellable).
- Recipe
Book Filled Event - A player auto-filled a recipe from the recipe book.
- Recipe
Locked Event - A recipe has been locked for the current player.
- Recipe
Register Event - A plugin is about to register a recipe (cancellable).
- Recipe
Registered Event - A recipe has been registered with the runtime registry.
- Recipe
Unlocked Event - A recipe has been unlocked for the current player.
- Recipe
Unregistered Event - A recipe has been removed from the runtime registry.
Enums§
- BusKind
- Which event bus an event type belongs to.
- Close
Reason - Why a container window is closing.
- Container
Click Type - Mirror of server’s click action that plugins can safely consume.
- Drag
Type - Type of drag operation (paint mode).
- Stage
- Execution stage for event handlers.
- Window
Slot Kind - Categorises which slot was clicked, independent of window type.
Traits§
- Event
- Trait implemented by all game events.
- Event
Routing - Declares which event bus an event type belongs to.