Gameplay patterns
A complete feature usually crosses several APIs. Keep each boundary small and let Bedriox remain authoritative.
A PvP arena flow
- A typed
/arena join <name>command records the player's intent. - Resolve the player and arena world, then teleport through the Player API.
- Schedule a countdown and show each tick through a popup or title.
- Listen for combat, death, disconnect, and world-unload events.
- Track only UUIDs and plugin-owned arena state—not internal player objects.
- Award immutable item stacks through a fresh inventory handle.
- Cancel timers, release containers, and clear arena state during shutdown.
Async boundary
Use async work only for computation or external I/O that does not touch live Bedriox objects. Return a small data result to scheduled main-thread work, resolve current players/worlds/entities again, validate that the match is still active, and only then request mutations.
