How to cancel the loading of a plugin?

Discussion in 'Plugin Development' started by DjDCH, Jan 19, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    DjDCH

    I'm facing this issue since I notice error can occur in the loading process and I want, when this occurred, stop the loading process of the plugin. I don't know if this already possible with bukkit, but it would be nice to have the possibility to do it. So, how to cancel the loading of a plugin?
     
  2. Offline

    MysticX

    I'm not sure if you can cancel the loading, but you can try to disable it again via the Pluginmanager.

    Code:
    plugin.getServer().getPluginManager().disablePlugin(arg0)
     
  3. Offline

    DjDCH

    Forgot to say that I have already try this. When you are in the loading process, this mutator have no effect.

    Bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 6, 2016
  4. Offline

    DjDCH

    I just took a look to the CraftBukkit code to see how a plugin is enable. Since the way the onEnable method is called, there no possibilities to do what I need to do.

    So, I request the implementation of a way to cancel a plugin from the onEnable method (like a specific exception to throw, a setCancelled mutator or a true/false boolean to return).
     
  5. Offline

    matjam

  6. Offline

    DjDCH

  7. Offline

    Tahg

    Let me clarify here. You want to disable your own plugin, if for some reason it fails to properly initialize? This seems like a logical thing to do and we can look into it. We will NOT however provide a mechanism to prevent the loading of other plugins if it is that that you want to do.
     
  8. Offline

    DjDCH

    This. Like I said, I need a way, from inside the onEnable method, to cancel a plugin from finishing its loading. I was thinking about a specific exception to throw, and I'm pretty convince that is the best way to do it.
     
  9. Offline

    Tahg

    Thanks for the clarification. I will bring this up with the team, but it sounds reasonable to me.
     
  10. Offline

    Afforess

    Look at how MMA or MMS disables itself if MMC is not installed.
     
  11. Offline

    DjDCH

    *Facepalm* While I was took a look to the CraftBukkit code, I had seen this method (setEnabled) but I don't realized that is what I've searching for. I will try it soon.

    Thanks Afforess ! :D
     
Thread Status:
Not open for further replies.

Share This Page