Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/kennytv/Maintenance/llms.txt

Use this file to discover all available pages before exploring further.

The MaintenanceReloadedEvent is fired whenever the Maintenance plugin configuration is reloaded, typically via the reload command.

Event Details

Package: eu.kennytv.maintenance.api.event Type: Notification event (read-only) Fired when:
  • The /maintenance reload command is executed
  • The plugin configuration is reloaded programmatically via the API

Class Definition

public final class MaintenanceReloadedEvent implements MaintenanceEvent {
}
This event has no methods or fields as it serves purely as a notification that the reload has occurred.

Accessing New Configuration

After this event is fired, you can access the updated maintenance status and settings:
Maintenance api = MaintenanceProvider.get();
boolean newStatus = api.isMaintenance();
Settings settings = api.getSettings();
For proxy servers, you can also check the updated list of servers under maintenance:
MaintenanceProxy proxy = (MaintenanceProxy) MaintenanceProvider.get();
Set<String> maintenanceServers = proxy.getMaintenanceServers();

Usage Example

Basic Example

import eu.kennytv.maintenance.api.Maintenance;
import eu.kennytv.maintenance.api.MaintenanceProvider;
import eu.kennytv.maintenance.api.event.MaintenanceReloadedEvent;
import eu.kennytv.maintenance.api.event.manager.EventListener;
import eu.kennytv.maintenance.api.event.manager.EventManager;

public class MyPlugin extends JavaPlugin {
    
    @Override
    public void onEnable() {
        Maintenance api = MaintenanceProvider.get();
        EventManager eventManager = api.getEventManager();
        
        eventManager.registerListener(new EventListener<MaintenanceReloadedEvent>() {
            @Override
            public void onEvent(MaintenanceReloadedEvent event) {
                getLogger().info("Maintenance configuration has been reloaded!");
                
                // Reload your own configuration that depends on Maintenance
                reloadConfig();
            }
        }, MaintenanceReloadedEvent.class);
    }
}

Example: Syncing Custom Configuration

import eu.kennytv.maintenance.api.Maintenance;
import eu.kennytv.maintenance.api.MaintenanceProvider;
import eu.kennytv.maintenance.api.event.MaintenanceReloadedEvent;
import eu.kennytv.maintenance.api.event.manager.EventListener;

public class ConfigSyncHandler {
    
    private final MyPlugin plugin;
    
    public ConfigSyncHandler(MyPlugin plugin) {
        this.plugin = plugin;
    }
    
    public void register(EventManager eventManager) {
        eventManager.registerListener(new EventListener<MaintenanceReloadedEvent>() {
            @Override
            public void onEvent(MaintenanceReloadedEvent event) {
                Maintenance api = MaintenanceProvider.get();
                
                // Check new maintenance status
                boolean isMaintenance = api.isMaintenance();
                plugin.getLogger().info("New maintenance status: " + isMaintenance);
                
                // Update your custom settings based on new config
                plugin.updateCustomSettings();
                
                // Notify staff members
                plugin.notifyStaff("Maintenance configuration reloaded!");
            }
        }, MaintenanceReloadedEvent.class);
    }
}

Example: Updating External Services

import eu.kennytv.maintenance.api.event.MaintenanceReloadedEvent;
import eu.kennytv.maintenance.api.event.manager.EventListener;

public class ExternalServiceSync {
    
    private final StatusPageAPI statusPage;
    private final MetricsService metrics;
    
    public ExternalServiceSync(StatusPageAPI statusPage, MetricsService metrics) {
        this.statusPage = statusPage;
        this.metrics = metrics;
    }
    
    public void register(EventManager eventManager) {
        eventManager.registerListener(new EventListener<MaintenanceReloadedEvent>() {
            @Override
            public void onEvent(MaintenanceReloadedEvent event) {
                Maintenance api = MaintenanceProvider.get();
                
                // Update external status page
                statusPage.updateMaintenanceStatus(api.isMaintenance());
                
                // Track reload in metrics
                metrics.recordEvent("maintenance_reload");
                
                // Log configuration changes
                Settings settings = api.getSettings();
                metrics.recordConfig(
                    "maintenance_enabled", 
                    String.valueOf(api.isMaintenance())
                );
            }
        }, MaintenanceReloadedEvent.class);
    }
}

Example: Proxy Server Integration

import eu.kennytv.maintenance.api.MaintenanceProvider;
import eu.kennytv.maintenance.api.event.MaintenanceReloadedEvent;
import eu.kennytv.maintenance.api.event.manager.EventListener;
import eu.kennytv.maintenance.api.proxy.MaintenanceProxy;

public class ProxyIntegration {
    
    public void register(EventManager eventManager) {
        eventManager.registerListener(new EventListener<MaintenanceReloadedEvent>() {
            @Override
            public void onEvent(MaintenanceReloadedEvent event) {
                MaintenanceProxy proxy = (MaintenanceProxy) MaintenanceProvider.get();
                
                // Log the new global maintenance status
                System.out.println("Global maintenance: " + proxy.isMaintenance());
                
                // Log all servers in maintenance mode
                Set<String> maintenanceServers = proxy.getMaintenanceServers();
                System.out.println("Servers in maintenance: " + maintenanceServers);
                
                // Update load balancer configuration
                updateLoadBalancer(maintenanceServers);
            }
        }, MaintenanceReloadedEvent.class);
    }
    
    private void updateLoadBalancer(Set<String> maintenanceServers) {
        // Your load balancer update logic
    }
}

See Also

Build docs developers (and LLMs) love