Reduce future join call usage

This commit is contained in:
William committed 2022-09-24 22:00:48 +01:00
1 parent 8a4ed7c565
commit 649d4c0600
18 files changed
+316 -291

No files matched your search

@@ -54,9 +54,8 @@ public class RtpCommand extends CommandBase implements ConsoleExecutable {
final OnlineUser userToTeleport = target;
final boolean isExecutorTeleporting = userToTeleport.uuid.equals(onlineUser.uuid);
CompletableFuture.runAsync(() -> {
plugin.getDatabase().getUserData(onlineUser.uuid).thenAccept(userData -> {
// Check the user is not still on /rtp cooldown
final Optional<UserData> userData = plugin.getDatabase().getUserData(onlineUser.uuid).join();
if (userData.isEmpty()) {
return;
}