Future wouldn't have been completed
This commit is contained in:
parent
f8e968fb9e
commit
b26392c980
@ -19,6 +19,8 @@ import net.luckperms.api.LuckPermsProvider;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.CompletionException;
|
||||
|
||||
@Plugin(id = "@ID@", name = "@NAME@", version = "@VERSION@", description = "@DESCRIPTION@", authors = {"ActualPlayer"}, dependencies = { @Dependency(id = "luckperms", optional = true) })
|
||||
public class RememberMe {
|
||||
@ -72,9 +74,12 @@ public class RememberMe {
|
||||
handler.getLastServerName(chooseServerEvent.getPlayer().getUniqueId()).thenAcceptAsync(lastServerName -> {
|
||||
if (lastServerName != null) {
|
||||
getServer().getServer(lastServerName).ifPresent((registeredServer) -> {
|
||||
registeredServer.ping().thenRun(() -> {
|
||||
chooseServerEvent.setInitialServer(registeredServer);
|
||||
});
|
||||
try {
|
||||
registeredServer.ping().join();
|
||||
} catch(CancellationException|CompletionException exception) {
|
||||
return;
|
||||
}
|
||||
chooseServerEvent.setInitialServer(registeredServer);
|
||||
});
|
||||
}
|
||||
}).join();
|
||||
|
Loading…
Reference in New Issue
Block a user