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
| Lifecycle | Usage |
|---|---|
onEnable | Called when enabling your plugin after all other Vital modules have been enabled. You can safely use all Vital functionality. |
onDisable | Called when your plugin is disabled before all other Vital modules are disabled. You can safely use all Vital functionality. |