Event Manager
TheEventManager is the core interface for working with events. You can access it through the main Maintenance API instance:
EventManager Methods
registerListener
Registers an event listener for a specific event type.listener- The listener instance to registereventClass- The event class to listen for
callEvent
Fires a maintenance event (typically used internally by the plugin).event- The event to fire
EventListener Interface
All event listeners must extend theEventListener<T> abstract class, where T is the event type you want to listen to.
Registering Event Listeners
To listen to an event, create a class that extendsEventListener and register it with the EventManager.
Example: Listening to Maintenance Changes
Example: Listening to Multiple Events
Available Events
The Maintenance plugin provides the following events:- MaintenanceChangedEvent - Fired when maintenance mode is enabled or disabled
- MaintenanceReloadedEvent - Fired when the plugin configuration is reloaded
- ServerMaintenanceChangedEvent - Fired when maintenance mode changes on a specific server (proxy only)
MaintenanceEvent Interface
All events implement theMaintenanceEvent interface, which serves as a marker interface for all maintenance-related events: