From 8f0c4b87b025e3d7f8cb0b15cbbbeb6d262eb257 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Fri, 30 Oct 2020 18:54:06 +0100 Subject: [PATCH] Created Components (markdown) --- Components.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Components.md diff --git a/Components.md b/Components.md new file mode 100644 index 0000000..f5f9b96 --- /dev/null +++ b/Components.md @@ -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` 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()`.