Solved How to cancel one scheduler and start one after the previous one is cancelled

Discussion in 'Plugin Development' started by voltywolty, Oct 26, 2021.

  1. Offline

    voltywolty

    Hey all. I'm curious on how I can have a schedule countdown something, then when its below a certain value, it cancels that scheduler and call to start a different one. I am currently using a scheduleSyncRepeatingTask to decrease a timer, but I also want it to cancel when it hits 0, but I don't think it works with scheduleSyncRepeatingTasks.
     
  2. Offline

    timtower Administrator Administrator Moderator

    @voltywolty If it is a BukkitRunnable you can just call cancel() inside of it.
     
  3. Offline

    Kars

    Personally i would use a delayed task that schedules the next delayed task, unless some condition is met.
     

Share This Page