fixed luckperms loading3
This commit is contained in:
parent
ecf5491165
commit
e8f4855eec
@ -63,10 +63,12 @@ public class RememberMe {
|
||||
if (!loginEvent.getPlayer().hasPermission("rememberme.notransfer")) {
|
||||
handler.getLastServerName(loginEvent.getPlayer().getUniqueId()).thenAcceptAsync(lastServerName -> {
|
||||
if (lastServerName != null) {
|
||||
getServer().getServer(lastServerName).ifPresent(lastServer -> loginEvent.getPlayer().createConnectionRequest(lastServer).connectWithIndication());
|
||||
}
|
||||
getServer().getServer(lastServerName).ifPresent(lastServer -> {
|
||||
loginEvent.getPlayer().createConnectionRequest(lastServer).connectWithIndication();
|
||||
});
|
||||
}
|
||||
}).join();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -6,6 +6,8 @@ import me.lucko.luckperms.api.LuckPermsApi;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.caching.MetaData;
|
||||
import me.lucko.luckperms.api.context.ContextManager;
|
||||
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||
import me.lucko.luckperms.api.manager.UserManager;
|
||||
|
||||
import java.util.Optional;
|
||||
@ -26,13 +28,12 @@ public class LuckPermsHandler implements IRememberMeHandler {
|
||||
CompletableFuture<User> userFuture = userManager.loadUser(uuid);
|
||||
return userFuture.thenApply(user -> {
|
||||
if (user != null) {
|
||||
Optional<Contexts> contextsOpt = api.getContextManager().lookupApplicableContexts(user);
|
||||
ContextManager cm = api.getContextManager();
|
||||
Contexts contexts = cm.lookupApplicableContexts(user).orElse(cm.getStaticContexts());
|
||||
|
||||
if (contextsOpt.isPresent()) {
|
||||
MetaData metaData = user.getCachedData().getMetaData(contextsOpt.get());
|
||||
MetaData metaData = user.getCachedData().getMetaData(contexts);
|
||||
return metaData.getMeta().getOrDefault("last-server", null);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user