Splitting by features
We use dependencies-kt to split parts of our plugins into separate features and inject dependencies.
Idofront provides some extra helpers to register configs, listeners, and tasks
in a reload-friendly way. It also provides MainCommand to help each of your features register subcommands under a main plugin command.
You can see a typical configuration for all of these in ExamplePlugin.
Loading features
When features need dependencies such as other plugins, use loadAllCatching in onEnable, but
use require or requirePlugins to throw an error when conditions aren't met.
These will be nicely printed in console to explain to users why a feature didn't load.
To let users configure whether a feature can turn on or off, use a require block that checks an enabled property
in an injected config. You can use separate config files per feature or a main one that's injected in the plugin's main class.