What to use instead of sleep() in for loops?

Discussion in 'Plugin Development' started by bc112354, Jul 7, 2014.

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

    bc112354

    I know to keep away from sleep() because it makes the whole server go to sleep, but what should I use instead of sleep()?
     
  2. Offline

    Wizehh

    Use a Bukkit scheduled task or something of the like.
     
  3. Offline

    mythbusterma

    What reason do you have to be stalling anyway?
     
  4. Offline

    bc112354

    mythbusterma delay between lightning strikes.
    I don't know exactly which scheduler to use, because when strikeLightning() is executed I want it to strike immediately, then wait, then strike again.
     
  5. Offline

    mythbusterma

    BukkitScheduler#scheduleRepeatingTask(Plugin,Runnable,long,long)? This allows you to create a task that runs indefinitely on a delay until it is cancelled.
     
  6. Offline

    Garris0n

    new BukkitRunnable(){*stuff*}.runTaskTimer() for better self-cancellation.
     
    mythbusterma likes this.
Thread Status:
Not open for further replies.

Share This Page