2 minutes estimated read time

Main class

Once you have initialized your very first Vital plugin and have confirmed that it works by running it on a test server, you can start working on it.

Just like in a normal Spigot, Paper or BungeeCord server, every plugin has its own main class entrypoint.
This is where your plugin starts its lifecycle.

@VitalPlugin.Info(
  name = "myplugin",
  description = "myplugin description",
  apiVersion = "1.21",
  version = "1.0.0",
  author = {"me"}
)
public class MyPlugin extends VitalPlugin.Spigot { 
  @Override
  public void onEnable() {
    // Do something when your plugin is enabled.
  }
    
  @Override
  public void onDisable() {
    // Do something when your plugin is disabled.
  }
}

For example, you might want to prepare worlds or other data when your plugin is enabled.
And then unload all of that data when your plugin shuts down.

Lifecycles

LifecycleUsage
onEnableCalled when enabling your plugin after all other Vital modules have been enabled. You can safely use all Vital functionality.
onDisableCalled when your plugin is disabled before all other Vital modules are disabled. You can safely use all Vital functionality.

Found an issue?

Help us improve the documentation by reporting typos, missing information, or anything confusing.

Don't worry, we will auto-fill most of the annoying fields.

Create GitHub issue

This site and the Vital framework were built with ❤️ by Mike Neumann