Check if last server is online before setting initial server

This commit is contained in:
Flori4nK 2021-04-20 21:20:21 +02:00
parent 9741e66464
commit f8e968fb9e
No known key found for this signature in database
GPG Key ID: A45F90DA3BF1D357
2 changed files with 5 additions and 2 deletions

View File

@ -71,7 +71,11 @@ public class RememberMe {
if (!chooseServerEvent.getPlayer().hasPermission("rememberme.notransfer")) {
handler.getLastServerName(chooseServerEvent.getPlayer().getUniqueId()).thenAcceptAsync(lastServerName -> {
if (lastServerName != null) {
getServer().getServer(lastServerName).ifPresent(chooseServerEvent::setInitialServer);
getServer().getServer(lastServerName).ifPresent((registeredServer) -> {
registeredServer.ping().thenRun(() -> {
chooseServerEvent.setInitialServer(registeredServer);
});
});
}
}).join();
}

View File

@ -12,7 +12,6 @@ import net.luckperms.api.node.NodeType;
import net.luckperms.api.node.types.MetaNode;
import net.luckperms.api.query.QueryMode;
import net.luckperms.api.query.QueryOptions;
import org.checkerframework.checker.nullness.Opt;
import java.util.Collection;
import java.util.Optional;