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 org.slf4j.Logger;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
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) })
|
@Plugin(id = "@ID@", name = "@NAME@", version = "@VERSION@", description = "@DESCRIPTION@", authors = {"ActualPlayer"}, dependencies = { @Dependency(id = "luckperms", optional = true) })
|
||||||
public class RememberMe {
|
public class RememberMe {
|
||||||
@ -72,10 +74,13 @@ public class RememberMe {
|
|||||||
handler.getLastServerName(chooseServerEvent.getPlayer().getUniqueId()).thenAcceptAsync(lastServerName -> {
|
handler.getLastServerName(chooseServerEvent.getPlayer().getUniqueId()).thenAcceptAsync(lastServerName -> {
|
||||||
if (lastServerName != null) {
|
if (lastServerName != null) {
|
||||||
getServer().getServer(lastServerName).ifPresent((registeredServer) -> {
|
getServer().getServer(lastServerName).ifPresent((registeredServer) -> {
|
||||||
registeredServer.ping().thenRun(() -> {
|
try {
|
||||||
|
registeredServer.ping().join();
|
||||||
|
} catch(CancellationException|CompletionException exception) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
chooseServerEvent.setInitialServer(registeredServer);
|
chooseServerEvent.setInitialServer(registeredServer);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}).join();
|
}).join();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user