ProgRAMmer
ProgRAMmer

Reputation: 31

Java - Asnyc wait?

So I'm coding a Minecraft Client in JAVA and in a ,,Spammer'' module, I need to wait between messages. So this is my question, how? If I do Thread.sleep() or TimeUnit.MILLISECOND.wait(), it freezes the client while it's sending the messages.

Upvotes: 0

Views: 62

Answers (1)

Rene Enriquez
Rene Enriquez

Reputation: 1609

What you need to do is to use this class java.util.concurrent.Future. This one is intended to deal with async stuff. Check this article https://www.baeldung.com/java-future

Upvotes: 3

Related Questions