Skip to main content
This guide shows you how to add the Maintenance API to your plugin project and get started with basic usage.

Requirements

  • Java 21 or higher
  • Maintenance plugin installed on your server
  • Maven or Gradle build system

Adding the Dependency

Maven

Add the Maintenance API dependency to your pom.xml:

Gradle (Kotlin DSL)

Add the dependency to your build.gradle.kts:

Gradle (Groovy DSL)

Add the dependency to your build.gradle:
Use compileOnly (or provided scope in Maven) since the Maintenance plugin provides the API at runtime.

Getting the API Instance

The API is accessed through the MaintenanceProvider class:

Null Safety

The MaintenanceProvider.get() method returns @Nullable Maintenance, so always check for null:

Basic Usage Examples

Toggle Maintenance Mode

When you enable maintenance mode, all non-whitelisted players are immediately kicked from the server.

Access Settings

Listen to Events

Plugin Dependency

Make sure to declare Maintenance as a dependency in your plugin descriptor:

Paper/Spigot (plugin.yml)

BungeeCord (bungee.yml)

Use depend if your plugin requires Maintenance to function, or softdepend if it’s optional.

Verify Installation

To verify the API is working correctly:

Next Steps

  • Events - Learn about the event system in detail
  • Settings API - Working with settings and config
  • Examples - More complete usage examples