Waiting for a second

Discussion in 'Plugin Development' started by niccholaspage, Feb 24, 2011.

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

    niccholaspage

    My plugin has a countdown system so I would like it to pause in between each time it says a number.
    Ex:
    3
    Wait a second
    2
    Wait another second
    1
    Another second
    GO!

    I found some code to do this but it made the server wait every time my plugin ran the countdown. How would I do this without having the server wait?
     
  2. Offline

    Afforess

    Create a new thread. Put the code you want to run after one second in it. Hook it into getServer().getBukkitScheduler().delaySyncEvent(plugin, thread, 20). (20 ticks == 1 sec. 1 tick == 50 ms).Do that for the other counters too, just modifying the delay count.
     
Thread Status:
Not open for further replies.

Share This Page