Events
Register an object containing #[EventHandler] methods. Each handler accepts
one event type; Bedriox discovers the type from the parameter and runs handlers
in priority order.
public function onEnable(): void
{
$this->context()->events()->registerSubscriber($this);
}
#[EventHandler(priority: EventPriority::HIGH)]
public function onAttack(PlayerAttackEvent $event): void
{
if ($event->damage() > 8.0) {
$event->setDamage(8.0);
}
}
Pre-events may expose cancellation or bounded replacement values. Post-events
describe an action that already committed and should be treated as observation.
MONITOR runs last and is read-only. Open an event in the catalog for its exact
timing, cancellation effect, available values, related events, and a copyable
listener example.
Find the event you need
The guide covers the listener pattern. For every available player, block, entity, inventory, world, command, and server event, browse the complete event catalog. Each event page explains what it represents, when it fires, the values and methods it exposes, and shows a listener you can copy.
