Skip to main content
The Maintenance API provides programmatic access to control and monitor maintenance mode on your Minecraft server. It allows plugin developers to integrate with Maintenance’s features, listen to events, and manage the maintenance state.

What You Can Do

The Maintenance API enables you to:
  • Toggle maintenance mode programmatically
  • Check maintenance status and running tasks
  • Manage whitelisted players during maintenance
  • Listen to maintenance events (mode changes, config reloads)
  • Access configuration settings from your plugin
  • Control debug mode for troubleshooting

Use Cases

Server Management Plugins

Integrate maintenance mode controls into your server management dashboard or control panel.
Maintenance api = MaintenanceProvider.get();
if (api != null) {
    api.setMaintenance(true);
    // All non-whitelisted players will be kicked
}

Event-Based Automation

React to maintenance mode changes with custom logic.
api.getEventManager().registerListener(
    event -> {
        MaintenanceChangedEvent e = (MaintenanceChangedEvent) event;
        if (e.isMaintenance()) {
            // Maintenance enabled - run cleanup tasks
        } else {
            // Maintenance disabled - prepare server
        }
    },
    MaintenanceChangedEvent.class
);

Player Management

Dynamically manage who can join during maintenance.
Settings settings = api.getSettings();
UUID playerUuid = UUID.fromString("...");

// Add player to maintenance whitelist
settings.addWhitelistedPlayer(playerUuid, "PlayerName");

// Check if player is whitelisted
if (settings.isWhitelisted(playerUuid)) {
    // Player can join during maintenance
}

// Remove from whitelist
settings.removeWhitelistedPlayer(playerUuid);

API Structure

The API is organized into several key interfaces:

Core Interfaces

  • Maintenance - Main API interface for controlling maintenance mode
  • MaintenanceProvider - Static provider to access the API instance
  • Settings - Access to configuration and whitelist management

Event System

  • EventManager - Register listeners for maintenance events
  • MaintenanceChangedEvent - Fired when maintenance mode changes
  • MaintenanceReloadedEvent - Fired when configuration is reloaded
  • EventListener - Functional interface for event handling

Key Methods

The Maintenance interface (from /home/daytona/workspace/source/api/src/main/java/eu/kennytv/maintenance/api/Maintenance.java) provides:
void setMaintenance(boolean maintenance)    // Enable/disable maintenance
boolean isMaintenance()                      // Check if enabled
boolean isTaskRunning()                      // Check if timer is running
String getVersion()                          // Get plugin version
Settings getSettings()                       // Access settings
EventManager getEventManager()               // Register event listeners
The Settings interface provides whitelist management and configuration access:
boolean isWhitelisted(UUID uuid)
boolean addWhitelistedPlayer(UUID uuid, String name)
boolean removeWhitelistedPlayer(UUID uuid)
Map<UUID, String> getWhitelistedPlayers()
void reloadConfigs()

Platform Support

The API works across all supported platforms:
  • Paper/Spigot
  • BungeeCord/Waterfall
  • Velocity
  • Sponge
The core API remains the same regardless of platform, ensuring consistent behavior.

Next Steps

  • Setup - Add the API to your project and get started
  • Events - Learn about the event system
  • Settings API - Work with settings and config

Build docs developers (and LLMs) love