Skip to main content
The Maintenance plugin provides a simple event system that allows you to listen to various events such as maintenance mode changes and configuration reloads.

Event Manager

The EventManager 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.
Parameters:
  • listener - The listener instance to register
  • eventClass - The event class to listen for

callEvent

Fires a maintenance event (typically used internally by the plugin).
Parameters:
  • event - The event to fire

EventListener Interface

All event listeners must extend the EventListener<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 extends EventListener 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:

MaintenanceEvent Interface

All events implement the MaintenanceEvent interface, which serves as a marker interface for all maintenance-related events: