merged pull request #4 to fix #3 - add ping check to fix crash when last logged-out server is offline
This commit is contained in:
commit
d83c9c9851
@ -1,5 +1,8 @@
|
|||||||
# Remember Me
|
# Remember Me
|
||||||
Remember Me is a plugin for the Velocity Minecraft Proxy that allows users to login to the server they last logged out on
|
Remember Me is a plugin for the Velocity Minecraft Proxy that allows users to login to the server they last logged out on.
|
||||||
|
|
||||||
|
At the moment of writing the latest version of RememberMe requires Velocity 1.1 to work. Velocity 1.1 is not fully released yet but can be downloaded from their jenkins.
|
||||||
|
RememberMe versions < 1.2 can be used with the currently released version of Velocity, but have a mandatory dependency on Luckperms and have no further support.
|
||||||
|
|
||||||
## Permissions
|
## Permissions
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
@ -71,7 +73,14 @@ 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) -> {
|
||||||
|
try {
|
||||||
|
registeredServer.ping().join();
|
||||||
|
} catch(CancellationException|CompletionException exception) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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