Reputation: 31
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
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