Module System
As mentioned in the Design Philosophy, registering modules is pretty simple;
@Module(
name = "MyCoolModule",
description = "My cool example module!",
category = ModuleCategory.MISC
)
public class MyCoolModule {
}
As seen in the code example above, we register it with a name that cannot contain spaces and is generally UpperCamelCase. The class name is also required to be the exact same as the module name, no suffixes or prefixes attached.
Module instances are automatically subscribed to the event handler when they are enabled, and they arent when disabled. Keep in mind this does not apply to static methods.
Extensions
Modules can implement specific "extensions" that add hooks to run.
The current hooks are:
EnableDisableHook: Module enable and disable overrides
EnableDisableHook
@Module(
name = "MyCoolModule",
description = "My cool example module!",
category = ModuleCategory.MISC
)
public class MyCoolModule implements EnableDisableHook {
@Override
public void onEnable() {
// on enable
}
@Override
public void onDisable() {
// on disable
}
}