Check if last server is online before setting initial server
This commit is contained in:
parent
9741e66464
commit
f8e968fb9e
@ -71,7 +71,11 @@ public class RememberMe {
|
|||||||
if (!chooseServerEvent.getPlayer().hasPermission("rememberme.notransfer")) {
|
if (!chooseServerEvent.getPlayer().hasPermission("rememberme.notransfer")) {
|
||||||
handler.getLastServerName(chooseServerEvent.getPlayer().getUniqueId()).thenAcceptAsync(lastServerName -> {
|
handler.getLastServerName(chooseServerEvent.getPlayer().getUniqueId()).thenAcceptAsync(lastServerName -> {
|
||||||
if (lastServerName != null) {
|
if (lastServerName != null) {
|
||||||
getServer().getServer(lastServerName).ifPresent(chooseServerEvent::setInitialServer);
|
getServer().getServer(lastServerName).ifPresent((registeredServer) -> {
|
||||||
|
registeredServer.ping().thenRun(() -> {
|
||||||
|
chooseServerEvent.setInitialServer(registeredServer);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}).join();
|
}).join();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import net.luckperms.api.node.NodeType;
|
|||||||
import net.luckperms.api.node.types.MetaNode;
|
import net.luckperms.api.node.types.MetaNode;
|
||||||
import net.luckperms.api.query.QueryMode;
|
import net.luckperms.api.query.QueryMode;
|
||||||
import net.luckperms.api.query.QueryOptions;
|
import net.luckperms.api.query.QueryOptions;
|
||||||
import org.checkerframework.checker.nullness.Opt;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
Loading…
Reference in New Issue
Block a user