[SOLVED] Countdown

Discussion in 'Spigot Help' started by LazerShadow, May 28, 2015.

  1. I am wanted to make something where when you die it puts you in spectator mode for 3 seconds then teleports you somewhere. I know how to do everything but one thing, and thats waiting 3 seconds. So how can I make it so once the code if run, it waits 3 seconds and then does something.
     
  2. Code (Text):
    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                            @Override
                            public void run() {
                                    cooldown.remove(player);
                            }
                    }, 100L);
    That's the way I do it in one of my plugins, the number at the bottom is the number of ticks, so if you wanted 3 seconds you would put 60L there. Not sure if this is the best or most efficient way, but it works for me.
     
    • Like Like x 1