Documentation Index
Fetch the complete documentation index at: https://mintlify.com/CCBlueX/LiquidBounce/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheEventManager is the central hub for LiquidBounce’s event system. It manages event registration, dispatching, and provides reactive event flows using Kotlin coroutines.
Key Features
- Fast event dispatching using lookup tables
- Support for event hooks and listeners
- Reactive event streams via Kotlin Flows
- Priority-based event handling
- Automatic error handling and reporting
Core Methods
registerEventHook
Registers an event hook for a specific event type.eventClass- The class of the event to listen foreventHook- The hook to execute when the event is called
unregisterEventHook
Unregisters a previously registered event hook.callEvent
Dispatches an event to all registered listeners.event- The event instance to dispatch
eventFlow
Gets a reactive flow for a specific event type.eventClass- The class of the event to observe
SharedFlow that emits events after all hooks are executed
Example:
Event Lifecycle
- Event Creation - An event instance is created
- Event Dispatch -
callEvent()is called with the event - Hook Execution - All registered hooks are executed in order
- Flow Emission - Event is emitted to the reactive flow
- Completion - Event’s
isCompletedflag is set totrue
Error Handling
The EventManager automatically handles exceptions in event handlers:ReportedException- Logged via ErrorHandler with detailed reporting- Other exceptions - Logged with event and handler context
- Errors don’t prevent other handlers from executing
Best Practices
See Also
- Event Types - Complete list of available events
- Module Development - Using events in modules