tasks

Discussion in 'Plugin Development' started by ulsa, Jul 30, 2014.

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

    ulsa

    guys im trying to get this working for a long time
    im trying to run a scheduleSyncRepeatingTask but randomizing the delay everytime
    at first i tried running a delayedtask inside a repeating one and didnt worked well "it was getting the delay of repeating task , delay of delayedtask was not doing anything"
    http://hastebin.com/cozawegoha.coffee


    than i tried running with bukkitrunnable and delayedtasks / delayed runnable's and couldnt work out

    so i want to ask how can i make a delayedtask to call itself after an if ?

    also I would like to learn what does bukkitrunnable exists if we have schedulers ?
     
  2. Offline

    Totom3

    Code:java
    1. BukkitTask task = new BukkitRunnable() {
    2.  
    3. @Override
    4. public void run() {
    5.  
    6. // Your code here....
    7.  
    8. this.runTaskLater(plugin, 300 + (Math.random() * 200));
    9. }
    10. }.runTaskLater(plugin, 100);

    Will first call the runnable after 100 ticks (5 seconds), and it will re-run itself after a random delay, going from 300 ticks (15 seconds) to 500 ticks (25 seconds).
     
Thread Status:
Not open for further replies.

Share This Page