Hello, I have a question, how could I go through a couple lines slowly? Like if I put; Code (Text): p.sendMessage("1"); Then wait one second and say; Code (Text): p.sendMessage("2"); Then wait another second and say; Code (Text): p.sendMessage("3"); I am pretty sure you can do this with Bukkit runnable's but I'm not really good with using Bukkit runnable's. I want to loop through something that sets blocks to ice but I want to do it slowly. If someone could just explain how to do this (Pretty sure you can do it) that would be awesome, thanks!
Code (Text): Bukkit.getScheduler().runTaskLater(this, new Runnable() { @Override public void run() { //Run Code here } }, seconds * 20);
You could use a repeating task like this: Code (Text): int i = 0; BukkitRunnable br = new BukkitRunnable() { @Override public void run() { i++;| //do your code here, Maybe add the location of the ice blocks in an array and do BlockArray[i] if (i == 4) { cancel(); //Will stop the timer } } }; br.runTaskTimer(this, /*starting time*/ 20, seconds * 20); edit: 1 mistake. Here is a nice video about Repeating tasks
Just to point out, the video linked is an inefficient way if handling cooldowns. If you ever have to deal with them, store a msp with the player's uuid and the time their cooldown ends (as a long using System.currentTimeMillis() + cooldownLength) and when telling them how long is left, compare the end of their cooldown to the current time in millis and turn it into a readable format using the TimeUnit enum.