Skip to content

ShutdownEvent

Package: com.hypixel.hytale.server.core.event.events Implements: IEvent<Void> Cancellable: No

Marker event dispatched during the server shutdown lifecycle. This event carries no instance data fields, but defines static priority constants that govern the ordering of shutdown-phase listeners. Listeners registered at these priority levels handle orderly teardown stages.

ConstantTypeValueDescription
DISCONNECT_PLAYERSshort-48Priority for listeners that disconnect players
UNBIND_LISTENERSshort-40Priority for listeners that unbind network listeners
SHUTDOWN_WORLDSshort-32Priority for listeners that shut down worlds

These constants define well-known priority values for ordering shutdown-phase listener execution. Lower (more negative) values execute first, ensuring players are disconnected before network listeners are unbound, and network listeners are unbound before worlds are shut down.

This event has no instance data fields. It is dispatched using the class-dispatch shorthand eventBus.dispatch(ShutdownEvent.class).

  • HytaleServer.shutdown0() (line 459) via eventBus.dispatch(ShutdownEvent.class) — Server shutdown lifecycle.
// Standard shutdown listener:
getEventRegistry().register(ShutdownEvent.class, event -> {
// Perform cleanup
getLogger().info("Plugin shutting down");
});
// Listener at a specific shutdown phase:
getEventRegistry().register(ShutdownEvent.SHUTDOWN_WORLDS, ShutdownEvent.class, event -> {
// Runs at the SHUTDOWN_WORLDS phase (priority -32)
saveWorldData();
});
  • BootEvent — The counterpart lifecycle event, fired when the server boots.