Skip to main content
Version: 26.1.x

Lifecycle Events

dev.architectury.event.events.common.LifecycleEvent

Fires as the server starts up, shuts down, and loads or saves levels. Use these to set up and tear down server-side state at the right moment. All of these are notifications (you can't cancel them).

Events

EventListener receivesWhen
SERVER_BEFORE_STARTMinecraftServerThe earliest point the server is available.
SERVER_STARTINGMinecraftServerDuring server startup.
SERVER_STARTEDMinecraftServerServer is ready to accept players.
SERVER_STOPPINGMinecraftServerServer has begun shutting down.
SERVER_STOPPEDMinecraftServerServer has fully stopped.
SERVER_LEVEL_LOADServerLevelA level was loaded on the server.
SERVER_LEVEL_UNLOADServerLevelA level was unloaded on the server.
SERVER_LEVEL_SAVEServerLevelA level is being saved.
SETUP- (Runnable)Common setup has begun. Registries should be populated by now.

The server-state events use the ServerState listener (stateChanged(MinecraftServer)); the level events use ServerLevelState (act(ServerLevel)).

Example

LifecycleEvent.SERVER_STARTED.register(server -> {
System.out.println("Server is up with " + server.getPlayerCount() + " players");
});

LifecycleEvent.SERVER_LEVEL_LOAD.register(level -> {
// initialize per-level data
});
note

For the client equivalents (CLIENT_STARTED, CLIENT_STOPPING, CLIENT_LEVEL_LOAD, CLIENT_SETUP), see Client Lifecycle Events.