Solved Stop plugin from continuing to run (like System.exit) but without affecting the server

Discussion in 'Plugin Development' started by Blockhead7360, May 30, 2017.

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

    Blockhead7360

    Hello!

    Is there any way that I can shutdown a plugin so it doesn't continue to run without affecting the server during onEnable()?

    I used the disablePlugin method and that does disable the plugin but the code continues to run in onEnable().

    I used System.exit but obviously that terminates the entire Java process.

    Can anyone help? Thanks.
     
  2. Offline

    Caderape2

    @Blockhead7360 So you want to stop a plugin from another plugin ?
     
  3. Offline

    Blockhead7360

    @Caderape2 no, I just want the code to stop running. I want to run something like System.exit from my plugin but without shutting down the entire server.
     
  4. Offline

    Caderape2

    @Blockhead7360 use the key word return after disabling the plugin on your onEnable.

    edit: If you are disabling from a method outside of the onEnable, turn that method in a boolean, then you can cancel it on your onEnable
     
    Blockhead7360 likes this.
  5. Offline

    Zombie_Striker

    @Blockhead7360
    You can use PluginMan plugin to disable your plugin, or if you need a bit of code, use the PluginManager and disable your plugin.
     
  6. Offline

    Blockhead7360

    @Caderape2 ahh the boolean thing is what I needed! I can't believe I didn't think of that before.

    Thanks
     
Thread Status:
Not open for further replies.

Share This Page