Created Components (markdown)

Norbi Peti 2020-10-30 18:54:06 +01:00
parent ad21b56683
commit 8f0c4b87b0

7
Components.md Normal file

@ -0,0 +1,7 @@
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()`.