Compare commits

...

10 Commits

Author SHA1 Message Date
82d6c04d58
Fork changes 2024-04-15 20:00:30 +03:00
ActualPlayer
891584611c bugfix nullpointer in filehandler 2021-05-17 18:04:18 +02:00
ActualPlayer
48b3db534d removed kotlin build gradle 2021-05-17 15:12:49 +02:00
ActualPlayer
c89cbedcbb bumped version 2021-05-15 10:40:18 +02:00
ActualPlayer
d83c9c9851 merged pull request #4 to fix #3 - add ping check to fix crash when last logged-out server is offline 2021-05-15 10:39:22 +02:00
ActualPlayer
19cf9bc35e updated velocity to 1.1.5 and luckperms api to 5.3 2021-05-15 10:30:03 +02:00
Flori4nK
b26392c980
Future wouldn't have been completed 2021-04-20 22:16:30 +02:00
Flori4nK
f8e968fb9e
Check if last server is online before setting initial server 2021-04-20 21:20:21 +02:00
ActualPlayer
9741e66464
Update README.md 2020-09-01 08:34:44 +02:00
ActualPlayer
e02da1a7fa version bump 2020-07-16 14:45:24 +02:00
8 changed files with 70 additions and 72 deletions

View File

@ -1,5 +1,8 @@
# 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

46
build.gradle Normal file
View File

@ -0,0 +1,46 @@
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
}

View File

@ -1,57 +0,0 @@
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-5.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0
gradlew vendored Normal file → Executable file
View File

View File

@ -19,8 +19,10 @@ 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) })
@Plugin(id = "@ID@", name = "@NAME@", version = "@VERSION@", description = "@DESCRIPTION@", authors = {"ActualPlayer", "evert"}, dependencies = {@Dependency(id = "luckperms", optional = true)})
public class RememberMe {
@Getter
@ -51,6 +53,7 @@ public class RememberMe {
/**
* If LuckPerms is present, use the User meta tags to save last server
*
* @param event Velocity init event
*/
@Subscribe
@ -71,7 +74,14 @@ public class RememberMe {
if (!chooseServerEvent.getPlayer().hasPermission("rememberme.notransfer")) {
handler.getLastServerName(chooseServerEvent.getPlayer().getUniqueId()).thenAcceptAsync(lastServerName -> {
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();
}

View File

@ -5,9 +5,6 @@ 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;
@ -30,13 +27,13 @@ public class FileHandler implements IRememberMeHandler {
File userFile = FileUtils.getOrCreate(rememberMe.getDataFolderPath().resolve("data"), uuid.toString() + ".yml");
UserServer userServer = YamlUtils.readFile(userFile, UserServer.class);
if(userServer == null) return null;
Optional<RegisteredServer> serverOpt = rememberMe.getServer().getServer(userServer.getServer());
CompletableFuture<String> future = new CompletableFuture<>();
if(userServer == null) {
future.complete(null);
} else {
Optional<RegisteredServer> serverOpt = rememberMe.getServer().getServer(userServer.getServer());
future.complete(serverOpt.map(registeredServer -> registeredServer.getServerInfo().getName()).orElse(null));
}
return future;
} catch (IOException ex) {
return null;

View File

@ -12,7 +12,6 @@ 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;