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 yourpom.xml:
Gradle (Kotlin DSL)
Add the dependency to yourbuild.gradle.kts:
Gradle (Groovy DSL)
Add the dependency to yourbuild.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 theMaintenanceProvider class:
Null Safety
TheMaintenanceProvider.get() method returns @Nullable Maintenance, so always check for null:
Basic Usage Examples
Toggle Maintenance Mode
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)
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