Change delay of BukkitTask

Discussion in 'Plugin Development' started by ZephireNZ, Mar 22, 2013.

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

    ZephireNZ

    I've got a BukkitTask set up to run after 60 seconds.
    Code:java
    1.  
    2. new stopFlyTask(this, player).runTaskLater(this, (long) timeLong);
    3.  

    How can I make it so I can add, say 30 seconds, to that delay? Would be enough just to change timeLong, or do I have to do something more complex?
     
  2. Offline

    ZeusAllMighty11

    I think delays are measured in Ticks still in BukkitTask, so 20 * 30 = 600 seconds

    So change 'timeLong' to 600
     
  3. Offline

    ZephireNZ

    Yeah, I understand that. But if I have a Task already running, and I want to add to the delay of it, is it possible?
     
  4. Offline

    Codex Arcanum

    You could store the task number of the stopflytask, then when you want to change the duration, kill the task and restart it with the new duration. May be a better way, but that would work.
     
  5. Offline

    PogoStick29

    You should use the Bukkit Scheduler.
     
  6. Offline

    ZeusAllMighty11

    That is what a BukkitTask is... /facepalm
     
    Skyost likes this.
  7. Offline

    ZephireNZ

    This is a Bukkit Scheduler task. (note the "runTaskLater")
     
  8. Offline

    PogoStick29

    Ok, ok. Sorry :p

    I got confused, as that is a method in SwingUtils (or at least there is a method named like it).

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  9. Offline

    ZeusAllMighty11

    PogoStick29

    Java Swing and Bukkit are two completely different things. You should not be getting confused between two libraries just because they have the same methods. :p

    But yes, SwingUtils does include a invokeLater() method
     
  10. Offline

    PogoStick29

    I am deeply sorry, but they are both related to Java and I didn't notice that the OP said BukkitTask at the top of the post.
     
Thread Status:
Not open for further replies.

Share This Page