-
Notifications
You must be signed in to change notification settings - Fork 3
v3 KamiPlugin
See V4 Getting Started for more information.
This feature is only available in spigot-utils
and its inheritors (spigot-jar
).
KamiPlugin
is an extension of JavaPlugin
with additional methods to assist in development, and better integration within the KamiCommon ecosystem.
KamiPlugin
asks for users to use non-standard methods for enable and disable:
@Override
public void onEnableInner() {
// Enable code here
}
@Override
public void onDisableInner() {
// Disable code here
}
This is because KamiPlugin
wraps these methods using pre- and post- methods, which will log the time taken to enable and disable the plugin.
KamiPlugin
also provides additional methods for registering command bukkit types that will be remembered and disabled when the plugin shuts down.
Here are some examples:
kamiPlugin.registerListener(myListener = new MyListener());
kamiPlugin.registerDisableable(myDisableableObject = new MyDisableableObject());
kamiPlugin.registerTask(myBukkitTask);
// Corresponding methods exist to unregister these objects as well.
kamiPlugin.unregisterListener(myListener);
kamiPlugin.unregisterDisableable(myDisableableObject);
kamiPlugin.unregisterTask(myBukkitTask);
KamiPlugin
also provides integration with the module system, providing methods to register modules inside the plugin.
Here is that method:
// The module system will automatically construct (using empty constructor) and register the module.
// It will have its internal config loaded and then startup methods called, along with disable method called on plugin and/or module shutdown.
kamiPlugin.registerModule(CustomEnchantsModule.class);
For more information on the module system, see the Module System page.