Minecraft Java Plugin: 1 second Wait> Command> Wait a second> Command> etc. How do I do that?

co
- in Plugins
11

How do I do that, 1 second is waited. I believe 1 sec = 20 ticks. Is that correct?

Example:

p.sendMessage ("§a [SCMD +] Show information from the server.");
// WAITED FUNCTION
p.sendMessage ("Bukkit>" + Bukkit.getVersion ());
// WAITED FUNCTION
p.sendMessage ("Name>" + Bukkit.getServerName ());
// WAITED FUNCTION
p.sendMessage ("ID>" + Bukkit.getServerId ());
// WAITED FUNCTION
p.sendMessage ("IP>" + Bukkit.getIp ());
// WAITED FUNCTION
p.sendMessage ("Port>" + Bukkit.getPort ());

vo
-1

Yes, but of course JavaSESE has its own time tracking, delay and scheduling methods.

co
-1

Thanks for the answer.

What are those methods. So how do I use this on "// wait function"?

Ap
-1

You have to use a scheduler from Bukkit, if you have TS or similar, I also like to help you.

vo
-1

For example, read https://docs.oracle.com/...hread.html here

But putting in delays in an event is a bad idea in some frameworks.

co
-1

I once saw someone

Thread.sleep (2000);

But that does not hit the thread, and I do not want that.

co
-1

Unfortunately, my microphone is not working right now. But thanks for your answer

vo
-1

What do you think, what that means?

co
-1

I do not care. I'll have a look. I'm only aware of what that does.

vo
-1

Just read the APIdoc.

co
-1

I just do not get it and I'll fall asleep right away. Could you give me the order quickly? I searched the net everywhere.

Just tell me what's there. I do not want to stop the thread so I want solage the timeout or delay laueft what chat can write.

p.sendMessage ("IP>" + Bukkit.getIp ());

// WAITED FUNCTION

p.sendMessage ("Port>" + Bukkit.getPort ());

Dr
-2

Bukkit.getScheduler (). RunTaskLater (Bukkit.getPluginManager (). GetPlugin ("DeinPluginName"), () → {
// Here the delayed code must be pure
}, 20L);