Skip to main content
A Minestom runtime module is a JVM object installed and started by GroundsServer. Use descriptor-backed providers for reusable modules so the runtime can validate dependencies before Minestom accepts players.

Module lifecycle

Implement GroundsModule for runtime behavior.
The runtime filters incompatible provider modules, validates descriptors, and orders modules before installation. It calls install(ctx) on all modules, starts Minestom, then calls start() in module order. During shutdown it calls stop() in reverse module order before registered shutdown hooks run.

Server context

GroundsServerContext provides runtime information and shared services.

Module providers

Use a GroundsModuleProvider when a module should be discoverable on the runtime classpath.
The provider is a runtime-facing factory. Keep construction cheap and defer I/O to install or start.

ServiceLoader registration

Provider-backed modules are discovered through Java ServiceLoader. Add this file to the module artifact:
META-INF/services/gg.grounds.runtime.GroundsModuleProvider
After the artifact is on the runtime classpath, GroundsServer.builder().discoverProviders() can find it.

Server-type compatibility

serverTypes controls where a provider is active.
Use ServerType.MINIGAME for game servers and ServerType.LOBBY for lobby-only modules. Omit the override only when the module supports both server types.

Service contracts

Use requires and provides to describe module-to-module contracts. Use dependsOn only for an ordering requirement that has no service contract.
Consumers require the same contract by type:
Use Service Registry for qualified-key guidance and the failure behavior for missing or duplicate services.

Next steps