I am having a problem with my soft dependency unloading before my plugin if it didn't exist before I loaded mine. This is how I have it set-up: The dependency is registered softly in my plugin.yml When my plugin is enabled the dependency is copied, loaded and enabled if it can not be found Whenever it does the second step the dependency doesn't seem to register as a soft dependency for my plugin and therefore unloads first. Is there any way to set the soft dependency after my plugin has been enabled?
Plugins always unload in reverse load order. If you load your soft dependency after your own plugin is loaded (which you're guaranteeing will happen if the soft dependency doesn't already exist when your plugin is first enabled), then your soft dependency will unload first.
Hmm. Can I listen for a plugin disable event and cancel it then disable it at the end of my onDisable();?
PluginDisableEvents don't appear to be cancellable. You can detect when the dependency plugin unloads, but if you re-enable it it'll just be unloaded immediately before your own plugin is unloaded - exactly as before.