Prevent deadlock in LuckPermsHandler #1350
This commit is contained in:
parent
7afda20288
commit
45dda0deba
@ -19,6 +19,9 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.TimeoutException;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +66,11 @@ public class LuckPermsHandler implements PermissionHandler {
|
|||||||
if (user == null) {
|
if (user == null) {
|
||||||
// user not loaded, we need to load them from the storage.
|
// user not loaded, we need to load them from the storage.
|
||||||
// this is a blocking call.
|
// 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
|
// then grab a new instance
|
||||||
user = luckPermsApi.getUser(playerUuid);
|
user = luckPermsApi.getUser(playerUuid);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user