1.15.2 Disable dependencies

Discussion in 'Spigot Plugin Development' started by Renamed, Feb 9, 2020.

  1. I have a main 'core' plugin which all of my other plugins depend on. In my core plugin, there is a way that it disables itself is it has been tampered with (someone has tried to crack my plugin). Is it possible to disable all of my other plugins that depend on my main one when I disable it? (Disable the other plugins from my main plugin) or do I have to create a check in each of the plugins to check if it has been disabled or not.
  2. If it disables before the others load then it should stop the others if its a hard dependancy. Possible try using onLoad() instead of onEnable(), not sure if it will work but the logic is there.
  3. A locked door only keeps out honest people

    Go through each plugin given by Bukkit#getPluginManager() and check what plugin they depend on and disable them if their depends contains your plugin
  4. I cant find a method to get dependencies of a plugin
  5. PluginDescriptionFile#getDepend returns a list of plugin names that its respective JavaPlugin depends on. You can get the PluginDescriptionFile with JavaPlugin#getDescription.
  6. How would I go about doing this if my main core plugin loads before all of my others? If my other plugins arent loaded yet then I cant get them to disable them. At this point I just dont think what I want to do is possible.
  7. You made it sound like you were trying to disable them if the core disabled while the server was running rather than starting. If you have your dependencies set up properly in your plugin.yml, plugins will only be enabled if their dependencies are also enabled.
    • Agree Agree x 1
  8. Your plugins should 'depend' upon your core plugin.

    Code your plugins to depend upon the core being loaded.

    Perhaps a code excerpt should be provided by yourself, for more focused assistance?
    #9 Goldentoenail, Feb 11, 2020
    Last edited: Feb 11, 2020
  9. Are you trying to disable plugins that already loaded and your core is disabled? As the only real way is to either use the event PluginDisableEvent and check if it’s your plugin or run a task. The first option is the safer and less heavy thing to do.
    • Agree Agree x 2