1 Components
NorbiPeti edited this page 2020-10-30 18:54:06 +01:00

Most of the functionality of the Chroma plugins are grouped into components. These components can be enabled/disabled at runtime both temporarily and permanently (so it doesn't load on the next start either). To make a new component, create a new class that inherits from Component<YourPluginClass> and implement the enable() and disable() methods. Note that components can be enabled/disabled multiple times while the server is running.

You also need to register the component to your plugin. Do Component.registerComponent(this, new SomeComponent()); where this is your plugin instance. All registered components are enabled automatically by default. You can use the @ComponentMetadata annotation's option to make a given component disabled by default.

You can also override the register() and unregister() methods which run when you call the corresponding methods.

You don't need to unregister components if you're using ButtonPlugin, as in that case they are unregistered between pluginPreDisable() and pluginDisable().