Solved Bug with bukkitrunnable

Discussion in 'Plugin Development' started by stefvanschie, Sep 5, 2015.

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

    stefvanschie

    Hey,

    I made a BukkitRunnable, which works perfectly fine. I made it so it cancells the timer when the arena is empty, but when I re-enter the arena (after the timer has cancelled) it throws an exception which says it's already scheduled. Help would be appreciated!
     
  2. Offline

    Oxyorum

    @stefvanschie Please post your code, or else we can't help you.
     
  3. Offline

    stefvanschie

    @Oxyorum
    Code:
    public void leave(Player player) {
      //some other stuff
      try {
        waitTimer.cancel();
      } catch (IllegalStateException ise) {} //yes I have tested if this worked and it did
      //some other stuff
    }
    
    public void join (Player player) {
      //some other stuff
      waitTimer.runTaskTimer(Main.getSInstance(), 20L, 20L);
      //some other stuff
    }
     
  4. Offline

    mythbusterma

    @stefvanschie


    You can't reschedule the same runnable. Don't do that.
     
  5. Offline

    stefvanschie

    @mythbusterma You can't? Even if it's cancelled?
    Edit: Ok, it works now, thanks
     
  6. Offline

    RainoBoy97

    Nope.
     
Thread Status:
Not open for further replies.

Share This Page