Hytale-documentation.github.io

Plugin Lifecycle

All Hytale server plugins must extend the com.hypixel.hytale.server.core.plugin.PluginBase class. This class provides the hook points for the server’s lifecycle events.

Lifecycle Methods

Your plugin should override the following methods to perform initialization and cleanup logic.

1. setup()

@Override
public void setup() {
    System.out.println("MyPlugin is setting up!");
    getEventRegistry().register(PlayerJoinEvent.class, event -> {
        System.out.println("Player joined: " + event.getPlayer().getName());
    });
}

2. start()

@Override
public void start() {
    System.out.println("MyPlugin has started!");
}

3. shutdown()

@Override
public void shutdown() {
    System.out.println("MyPlugin is shutting down!");
}

Plugin Manager

The PluginManager (com.hypixel.hytale.server.core.plugin.PluginManager) orchestrates these calls. It ensures that dependencies are respected (if the dependency system is exposed) and that all plugins transition through SETUP -> START -> STOP in unison.