Compare commits
10 Commits
59495d01e9
...
82d6c04d58
Author | SHA1 | Date | |
---|---|---|---|
82d6c04d58 | |||
|
891584611c | ||
|
48b3db534d | ||
|
c89cbedcbb | ||
|
d83c9c9851 | ||
|
19cf9bc35e | ||
|
b26392c980 | ||
|
f8e968fb9e | ||
|
9741e66464 | ||
|
e02da1a7fa |
@ -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
|
||||||
|
|
||||||
|
46
build.gradle
Normal file
46
build.gradle
Normal 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
|
||||||
|
}
|
@ -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")
|
|
||||||
}
|
|
||||||
}
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -19,8 +19,10 @@ 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", "evert"}, dependencies = {@Dependency(id = "luckperms", optional = true)})
|
||||||
public class RememberMe {
|
public class RememberMe {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -45,12 +47,13 @@ public class RememberMe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(optional = true)
|
@Inject(optional = true)
|
||||||
public void initLuckPerms(@Named("luckperms")PluginContainer luckPermsContainer) {
|
public void initLuckPerms(@Named("luckperms") PluginContainer luckPermsContainer) {
|
||||||
this.hasLuckPerms = luckPermsContainer != null;
|
this.hasLuckPerms = luckPermsContainer != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If LuckPerms is present, use the User meta tags to save last server
|
* If LuckPerms is present, use the User meta tags to save last server
|
||||||
|
*
|
||||||
* @param event Velocity init event
|
* @param event Velocity init event
|
||||||
*/
|
*/
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@ -71,7 +74,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();
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,6 @@ import com.actualplayer.rememberme.models.UserServer;
|
|||||||
import com.actualplayer.rememberme.util.FileUtils;
|
import com.actualplayer.rememberme.util.FileUtils;
|
||||||
import com.actualplayer.rememberme.util.YamlUtils;
|
import com.actualplayer.rememberme.util.YamlUtils;
|
||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
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.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -30,13 +27,13 @@ public class FileHandler implements IRememberMeHandler {
|
|||||||
File userFile = FileUtils.getOrCreate(rememberMe.getDataFolderPath().resolve("data"), uuid.toString() + ".yml");
|
File userFile = FileUtils.getOrCreate(rememberMe.getDataFolderPath().resolve("data"), uuid.toString() + ".yml");
|
||||||
UserServer userServer = YamlUtils.readFile(userFile, UserServer.class);
|
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<>();
|
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));
|
future.complete(serverOpt.map(registeredServer -> registeredServer.getServerInfo().getName()).orElse(null));
|
||||||
|
}
|
||||||
return future;
|
return future;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -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