Solved Plugin onDisable Cancel Runnables

Discussion in 'Plugin Development' started by krisdestruction, Aug 27, 2014.

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

    krisdestruction

    Hi,

    I was wondering if all tasks assocated with the plugin's scheduler are cancelled when a plugin is unloaded.
     
  2. Offline

    BillyGalbreath

    I've always just cancelled them manually in onDisable() just in case.
     
  3. Offline

    krisdestruction

    BillyGalbreath
    I see. How do you cancel them? I've done it in the past by putting it in a HashSet but BukkitScheduler.getPendingTasks() looks promising.
     
  4. Offline

    BillyGalbreath

    I've always stored them in a Set<BukkitRunnable> and just looped it to .cancel() them. I'll have to look into that .getPendingTasks(). Indeed it sounds promising. ^_^
     
    krisdestruction likes this.
  5. Offline

    fireblast709

  6. Offline

    BillyGalbreath

  7. Offline

    krisdestruction

    Damn....Thanks! lol

    fireblast709
    Last minute question, do you know if BukkitScheduler.cancelTasks() is called by bukkit automatically when the plugin is disabled?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
  8. Offline

    fireblast709

  9. Offline

    krisdestruction

    Thanks for the help. I'll do further tests.
     
  10. Offline

    krisdestruction

    fireblast709 BillyGalbreath
    I just tested with my plugin. It appears that TaskTimers are cancelled when I disable my plugin. I assume normal tasks will be cancelled too :)
     
Thread Status:
Not open for further replies.

Share This Page