Bukkit Task error ...

Discussion in 'Spigot Plugin Development' started by SkeletDev, May 19, 2016.

  1. Hello,

    I have a problem. I must cancel a BukkitTask to make thze performance better, but when i wil start the task again than is coming this error:

    java.lang.IllegalStateException: Already scheduled as 269

    have you a idea?
     
  2. That means you didn't actually stop the task the first time. If you try to start a task but it's already been scheduled, it will throw that Exception. Make sure you're calling the cancel() method on your BukkitRunnable
     
    • Agree Agree x 1
  3. Code (Text):
    Main.tickTask.runTaskTimer(Main.getInstance(), 0, 1);
    this is the start code

    Code (Text):
    Main.tickTask.cancel();
    this is the stop code
     
  4. Without seeing the entire class and how/where you're using the code above, there's really no way to know where the problem is