diff --git a/src/main/java/com/actualplayer/rememberme/RememberMe.java b/src/main/java/com/actualplayer/rememberme/RememberMe.java index 03123e7..93a0489 100644 --- a/src/main/java/com/actualplayer/rememberme/RememberMe.java +++ b/src/main/java/com/actualplayer/rememberme/RememberMe.java @@ -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();