From 45dda0deba81dfbcaa695a7940824fd07d7741e5 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 9 Oct 2017 09:02:14 +0200 Subject: [PATCH] Prevent deadlock in LuckPermsHandler #1350 --- .../authme/permission/handlers/LuckPermsHandler.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/permission/handlers/LuckPermsHandler.java b/src/main/java/fr/xephi/authme/permission/handlers/LuckPermsHandler.java index e76e65c14..25a8b8dc5 100644 --- a/src/main/java/fr/xephi/authme/permission/handlers/LuckPermsHandler.java +++ b/src/main/java/fr/xephi/authme/permission/handlers/LuckPermsHandler.java @@ -19,6 +19,9 @@ import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.UUID; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; /** @@ -63,7 +66,11 @@ public class LuckPermsHandler implements PermissionHandler { if (user == null) { // user not loaded, we need to load them from the storage. // this is a blocking call. - luckPermsApi.getStorage().loadUser(playerUuid).join(); + try { + luckPermsApi.getStorage().loadUser(playerUuid).get(1, TimeUnit.SECONDS); + } catch (InterruptedException | TimeoutException | ExecutionException e) { + e.printStackTrace(); + } // then grab a new instance user = luckPermsApi.getUser(playerUuid);