Compare commits

..

No commits in common. "82d6c04d582a86c1d10932b63b75476d47580db8" and "59495d01e978eddad52e42d960aeef7c0cb5e36c" have entirely different histories.

8 changed files with 72 additions and 70 deletions

View File

@ -1,8 +1,5 @@
# 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.
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.
Remember Me is a plugin for the Velocity Minecraft Proxy that allows users to login to the server they last logged out on
## Permissions

View File

@ -1,46 +0,0 @@
plugins {
id 'net.kyori.blossom' version '1.2.0'
id 'com.github.johnrengelman.shadow' version '7.0.0'
}
sourceCompatibility = JavaVersion.VERSION_17
group 'com.actualplayer'
version '1.2.4'
description 'A way for the user to login to the server he last connected to.'
repositories {
mavenCentral()
maven {
name = "papermc"
setUrl("https://repo.papermc.io/repository/maven-public/")
}
maven {
setUrl("https://repo.spongepowered.org/maven")
}
maven {
setUrl("https://repo.velocitypowered.com/snapshots/")
}
maven {
setUrl("https://libraries.minecraft.net/")
}
}
defaultTasks 'clean', 'build', 'shadowJar'
dependencies {
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.32'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.32'
implementation group: 'net.luckperms', name: 'api', version: '5.4'
compileOnly group: 'com.velocitypowered', name: 'velocity-api', version: '3.3.0-SNAPSHOT'
annotationProcessor group: 'com.velocitypowered', name: 'velocity-api', version: '3.3.0-SNAPSHOT'
}
blossom {
replaceToken '@ID@', name.replace(" ", "").toLowerCase()
replaceToken '@NAME@', name
replaceToken '@VERSION@', version
replaceToken '@DESCRIPTION@', description
}

57
build.gradle.kts Normal file
View File

@ -0,0 +1,57 @@
plugins {
java
id("net.kyori.blossom") version "1.1.0"
id("com.github.johnrengelman.shadow") version "4.0.4"
}
group = "com.actualplayer"
version = "1.2"
description = "A way for the user to login to the server he last connected to."
repositories {
mavenCentral()
maven {
name = "velocity"
setUrl("https://repo.velocitypowered.com/snapshots/")
}
maven {
setUrl("https://repo.spongepowered.org/maven")
}
maven {
setUrl("https://repo.velocitypowered.com/snapshots/")
}
maven {
setUrl("https://libraries.minecraft.net/")
}
}
defaultTasks("clean", "build", "shadowJar")
dependencies {
compileOnly("org.projectlombok:lombok:1.18.8")
annotationProcessor("org.projectlombok:lombok:1.18.8")
implementation("net.luckperms:api:5.1")
compileOnly("com.velocitypowered:velocity-api:1.1.0-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:1.1.0-SNAPSHOT")
testImplementation("junit", "junit", "4.12")
}
blossom {
replaceToken("@ID@", name.replace(" ", "").toLowerCase())
replaceToken("@NAME@", name)
replaceToken("@VERSION@", version)
replaceToken("@DESCRIPTION@", description)
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
}
configurations {
runtime {
exclude(group = "me.lucko.luckperms")
}
}

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0
gradlew vendored Executable file → Normal file
View File

View File

@ -19,10 +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", "evert"}, 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 {
@Getter
@ -53,7 +51,6 @@ public class RememberMe {
/**
* If LuckPerms is present, use the User meta tags to save last server
*
* @param event Velocity init event
*/
@Subscribe
@ -74,14 +71,7 @@ public class RememberMe {
if (!chooseServerEvent.getPlayer().hasPermission("rememberme.notransfer")) {
handler.getLastServerName(chooseServerEvent.getPlayer().getUniqueId()).thenAcceptAsync(lastServerName -> {
if (lastServerName != null) {
getServer().getServer(lastServerName).ifPresent((registeredServer) -> {
try {
registeredServer.ping().join();
} catch (CancellationException | CompletionException exception) {
return;
}
chooseServerEvent.setInitialServer(registeredServer);
});
getServer().getServer(lastServerName).ifPresent(chooseServerEvent::setInitialServer);
}
}).join();
}

View File

@ -5,6 +5,9 @@ import com.actualplayer.rememberme.models.UserServer;
import com.actualplayer.rememberme.util.FileUtils;
import com.actualplayer.rememberme.util.YamlUtils;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import ninja.leaping.configurate.ConfigurationNode;
import ninja.leaping.configurate.gson.GsonConfigurationLoader;
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
import java.io.File;
import java.io.IOException;
@ -27,13 +30,13 @@ public class FileHandler implements IRememberMeHandler {
File userFile = FileUtils.getOrCreate(rememberMe.getDataFolderPath().resolve("data"), uuid.toString() + ".yml");
UserServer userServer = YamlUtils.readFile(userFile, UserServer.class);
CompletableFuture<String> future = new CompletableFuture<>();
if(userServer == null) {
future.complete(null);
} else {
if(userServer == null) return null;
Optional<RegisteredServer> serverOpt = rememberMe.getServer().getServer(userServer.getServer());
CompletableFuture<String> future = new CompletableFuture<>();
future.complete(serverOpt.map(registeredServer -> registeredServer.getServerInfo().getName()).orElse(null));
}
return future;
} catch (IOException ex) {
return null;

View File

@ -12,6 +12,7 @@ import net.luckperms.api.node.NodeType;
import net.luckperms.api.node.types.MetaNode;
import net.luckperms.api.query.QueryMode;
import net.luckperms.api.query.QueryOptions;
import org.checkerframework.checker.nullness.Opt;
import java.util.Collection;
import java.util.Optional;