docs: update documentation; patch ChangeActiveSlotInteraction
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# Event System
|
||||
|
||||
The Hytale event system provides a powerful mechanism for plugins to react to game events. It supports both synchronous and asynchronous events with priority-based dispatching.
|
||||
The Hytale event system provides a powerful mechanism for plugins to react to game events. It supports both synchronous
|
||||
and asynchronous events with priority-based dispatching.
|
||||
|
||||
## Event Architecture
|
||||
|
||||
@@ -16,28 +17,29 @@ ICancellable // Mixin interface for cancellable events
|
||||
|
||||
### Key Classes
|
||||
|
||||
| Class | Description |
|
||||
|-------|-------------|
|
||||
| `IEvent<K>` | Synchronous event interface |
|
||||
| `IAsyncEvent<K>` | Asynchronous event interface |
|
||||
| `ICancellable` | Interface for events that can be cancelled |
|
||||
| `EventRegistry` | Plugin-specific event registration |
|
||||
| `SyncEventBusRegistry` | Global synchronous event bus |
|
||||
| `EventPriority` | Event listener priority levels |
|
||||
| Class | Description |
|
||||
|------------------------|--------------------------------------------|
|
||||
| `IEvent<K>` | Synchronous event interface |
|
||||
| `IAsyncEvent<K>` | Asynchronous event interface |
|
||||
| `ICancellable` | Interface for events that can be cancelled |
|
||||
| `EventRegistry` | Plugin-specific event registration |
|
||||
| `SyncEventBusRegistry` | Global synchronous event bus |
|
||||
| `EventPriority` | Event listener priority levels |
|
||||
|
||||
## Event Priorities
|
||||
|
||||
Events are dispatched to listeners in priority order:
|
||||
|
||||
| Priority | Value | Description |
|
||||
|----------|-------|-------------|
|
||||
| `FIRST` | -21844 | Runs first, before all others |
|
||||
| `EARLY` | -10922 | Runs early, after FIRST |
|
||||
| `NORMAL` | 0 | Default priority |
|
||||
| `LATE` | 10922 | Runs late, after NORMAL |
|
||||
| `LAST` | 21844 | Runs last, after all others |
|
||||
| Priority | Value | Description |
|
||||
|----------|--------|-------------------------------|
|
||||
| `FIRST` | -21844 | Runs first, before all others |
|
||||
| `EARLY` | -10922 | Runs early, after FIRST |
|
||||
| `NORMAL` | 0 | Default priority |
|
||||
| `LATE` | 10922 | Runs late, after NORMAL |
|
||||
| `LAST` | 21844 | Runs last, after all others |
|
||||
|
||||
Lower values run first. Use `FIRST` sparingly - typically for monitoring/logging. Use `LAST` for final processing after other plugins have had a chance to modify the event.
|
||||
Lower values run first. Use `FIRST` sparingly - typically for monitoring/logging. Use `LAST` for final processing after
|
||||
other plugins have had a chance to modify the event.
|
||||
|
||||
## Registering Event Listeners
|
||||
|
||||
@@ -148,45 +150,45 @@ getEventRegistry().register(EventPriority.LAST, PlayerInteractEvent.class, event
|
||||
|
||||
### Server Lifecycle Events
|
||||
|
||||
| Event | Description |
|
||||
|-------|-------------|
|
||||
| `BootEvent` | Server boot complete |
|
||||
| `ShutdownEvent` | Server shutting down |
|
||||
| Event | Description |
|
||||
|------------------------|-------------------------|
|
||||
| `BootEvent` | Server boot complete |
|
||||
| `ShutdownEvent` | Server shutting down |
|
||||
| `PrepareUniverseEvent` | Universe initialization |
|
||||
|
||||
### Player Events
|
||||
|
||||
| Event | Description |
|
||||
|-------|-------------|
|
||||
| `PlayerConnectEvent` | Player connected to server |
|
||||
| `PlayerDisconnectEvent` | Player disconnected |
|
||||
| `AddPlayerToWorldEvent` | Player added to a world |
|
||||
| `DrainPlayerFromWorldEvent` | Player removed from a world |
|
||||
| `PlayerInteractEvent` | Player interaction (cancellable) |
|
||||
| `PlayerMouseButtonEvent` | Mouse button input (cancellable) |
|
||||
| Event | Description |
|
||||
|-----------------------------|----------------------------------|
|
||||
| `PlayerConnectEvent` | Player connected to server |
|
||||
| `PlayerDisconnectEvent` | Player disconnected |
|
||||
| `AddPlayerToWorldEvent` | Player added to a world |
|
||||
| `DrainPlayerFromWorldEvent` | Player removed from a world |
|
||||
| `PlayerInteractEvent` | Player interaction (cancellable) |
|
||||
| `PlayerMouseButtonEvent` | Mouse button input (cancellable) |
|
||||
|
||||
### Entity Events
|
||||
|
||||
| Event | Description |
|
||||
|-------|-------------|
|
||||
| `EntityRemoveEvent` | Entity removed from world |
|
||||
| Event | Description |
|
||||
|-----------------------------|-----------------------------|
|
||||
| `EntityRemoveEvent` | Entity removed from world |
|
||||
| `LivingEntityUseBlockEvent` | Living entity using a block |
|
||||
|
||||
### World Events
|
||||
|
||||
| Event | Description |
|
||||
|-------|-------------|
|
||||
| `AddWorldEvent` | World added to universe |
|
||||
| `RemoveWorldEvent` | World removed |
|
||||
| `StartWorldEvent` | World started |
|
||||
| Event | Description |
|
||||
|------------------------|-----------------------------|
|
||||
| `AddWorldEvent` | World added to universe |
|
||||
| `RemoveWorldEvent` | World removed |
|
||||
| `StartWorldEvent` | World started |
|
||||
| `AllWorldsLoadedEvent` | All worlds finished loading |
|
||||
|
||||
### ECS Events
|
||||
|
||||
| Event | Description |
|
||||
|-------|-------------|
|
||||
| `UseBlockEvent` | Block usage event |
|
||||
| `DiscoverZoneEvent` | Zone discovery |
|
||||
| Event | Description |
|
||||
|---------------------|-------------------|
|
||||
| `UseBlockEvent` | Block usage event |
|
||||
| `DiscoverZoneEvent` | Zone discovery |
|
||||
|
||||
## Creating Custom Events
|
||||
|
||||
|
||||
Reference in New Issue
Block a user