Problem with BukkitRunnable

Discussion in 'Plugin Development' started by Paxination, Jan 25, 2014.

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

    Paxination

    PHP:
    private BukkitRunnable tptimer;
     
    tptimer = new BukkitRunnable(){
                @
    Override
                
    public void run() {
                    
    tplist.clear();
                }
            };
     
    tptimer.runTaskLater(plugin6000L);
     
    tptimer.cancel();
     
    tptimer.runTaskLater(plugin6000L);
    Assuming everything ran in the order it is shown here. I am getting an error.

    Caused by: java.lang.IllegalStateException: Already scheduled as 47

    and its on the second tptimer.runTaskLater(). Nothing else is rescheduling it.
     
  2. Offline

    xTrollxDudex

    Paxination
    You need to create a new instance of BukkitRunnable.
     
  3. Offline

    Paxination

    Ok, I get it. I thought you could just reschedule the same instance each time. And I thought this was what i was doing for my auto broadcaster. But I didnt realize that when I disable the plugin during the config reload, its creating a new instance of my task class which has my runnable for my auto bcast. So it was creating a new instance each time and i didnt realize it.
     
Thread Status:
Not open for further replies.

Share This Page