fix: Fixed some relocation issues
This commit is contained in:
parent
9453b8a925
commit
638be7d180
@ -5,6 +5,10 @@ plugins {
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://repo.alessiodp.com/releases/")
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply(plugin = "java")
|
||||
repositories {
|
||||
@ -14,11 +18,11 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
shadow(project(":authmevelocity-common"))
|
||||
shadow(project(":authmevelocity-common", "shadow"))
|
||||
shadow(project(":authmevelocity-api-paper"))
|
||||
shadow(project(":authmevelocity-api-velocity"))
|
||||
shadow(project(":authmevelocity-velocity"))
|
||||
shadow(project(":authmevelocity-paper"))
|
||||
shadow(project(":authmevelocity-velocity", "shadow"))
|
||||
shadow(project(":authmevelocity-paper", "shadow"))
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
@ -1,3 +1,7 @@
|
||||
plugins {
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://repo.alessiodp.com/releases/")
|
||||
}
|
||||
@ -8,3 +12,10 @@ dependencies {
|
||||
compileOnly("org.slf4j:slf4j-api:1.7.36")
|
||||
compileOnly("net.byteflux:libby-core:1.1.5")
|
||||
}
|
||||
|
||||
tasks {
|
||||
shadowJar {
|
||||
relocate("net.byteflux.libby", "me.adrianed.authmevelocity.libs.libby")
|
||||
relocate("space.arim.dazzleconf", "me.adrianed.authmevelocity.libs.dazzleconf")
|
||||
}
|
||||
}
|
@ -1,7 +1,48 @@
|
||||
package me.adrianed.authmevelocity.common;
|
||||
|
||||
//TODO: Abstract Class
|
||||
public interface LibsManager {
|
||||
void registerRepositories();
|
||||
void loadLibraries();
|
||||
import net.byteflux.libby.Library;
|
||||
import net.byteflux.libby.LibraryManager;
|
||||
import net.byteflux.libby.relocation.Relocation;
|
||||
|
||||
|
||||
public final class LibsManager {
|
||||
private final LibraryManager manager;
|
||||
|
||||
public LibsManager(LibraryManager manager) {
|
||||
this.manager = manager;
|
||||
manager.addMavenCentral();
|
||||
}
|
||||
|
||||
public void loadLibraries() {
|
||||
final String dazzlePackage = new String(new char[] {
|
||||
's','p','a','c','e','.','a','r','i','m','.','d','a','z','z','l','e','c','o','n','f'});
|
||||
final Relocation dazzleRelocation
|
||||
= new Relocation(dazzlePackage, "me.adrianed.authmevelocity.libs.dazzleconf");
|
||||
final Relocation snakeYamlRelocation
|
||||
= new Relocation("org.yaml.snakeyaml", "me.adrianed.authmevelocity.libs.snakeyaml");
|
||||
final Library dazzleConf = Library.builder()
|
||||
.groupId(dazzlePackage)
|
||||
.artifactId("dazzleconf-core")
|
||||
.version("1.3.0-M1")
|
||||
.relocate(dazzleRelocation)
|
||||
.build();
|
||||
final Library dazzleYaml = Library.builder()
|
||||
.groupId(dazzlePackage)
|
||||
.artifactId("dazzleconf-ext-snakeyaml")
|
||||
.version("1.3.0-M1")
|
||||
.relocate(dazzleRelocation)
|
||||
.relocate(snakeYamlRelocation)
|
||||
.build();
|
||||
final Library snakeYaml = Library.builder()
|
||||
.groupId("org.yaml")
|
||||
.artifactId("snakeyaml")
|
||||
.version("1.30")
|
||||
.relocate(dazzleRelocation)
|
||||
.relocate(snakeYamlRelocation)
|
||||
.build();
|
||||
|
||||
manager.loadLibrary(snakeYaml);
|
||||
manager.loadLibrary(dazzleConf);
|
||||
manager.loadLibrary(dazzleYaml);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
module me.adrianed.authmevelocity.common {
|
||||
requires transitive space.arim.dazzleconf.ext.snakeyaml;
|
||||
exports me.adrianed.authmevelocity.common;
|
||||
exports me.adrianed.authmevelocity.common.configuration;
|
||||
}
|
@ -35,13 +35,10 @@ tasks {
|
||||
shadowJar {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
relocate("net.byteflux.libby", "me.adrianed.authmevelocity.libs.libby")
|
||||
relocate("space.arim.dazzleconf", "me.adrianed.authmevelocity.libs.dazzleconf")
|
||||
configurations = listOf(project.configurations.shadow.get())
|
||||
}
|
||||
|
||||
build {
|
||||
dependsOn(shadowJar)
|
||||
}
|
||||
|
||||
compileJava {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
|
||||
|
@ -1,51 +0,0 @@
|
||||
package me.adrianed.authmevelocity.paper;
|
||||
|
||||
import me.adrianed.authmevelocity.common.LibsManager;
|
||||
import net.byteflux.libby.BukkitLibraryManager;
|
||||
import net.byteflux.libby.Library;
|
||||
import net.byteflux.libby.relocation.Relocation;
|
||||
|
||||
public class PaperLibraries implements LibsManager {
|
||||
private final BukkitLibraryManager manager;
|
||||
|
||||
public PaperLibraries(AuthMeVelocityPlugin plugin) {
|
||||
this.manager = new BukkitLibraryManager(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRepositories() {
|
||||
manager.addMavenCentral();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadLibraries() {
|
||||
final Relocation dazzleRelocation
|
||||
= new Relocation("space.arim.dazzleconf", "me.adrianed.authmevelocity.libs.dazzleconf");
|
||||
final Relocation snakeYamlRelocation
|
||||
= new Relocation("pattern", "me.adrianed.authmevelocity.libs.snake");
|
||||
final Library dazzleConf = Library.builder()
|
||||
.groupId("space.arim.dazzleconf")
|
||||
.artifactId("dazzleconf-ext-snakeyaml")
|
||||
.version("1.3.0-M1")
|
||||
.relocate(dazzleRelocation)
|
||||
.build();
|
||||
final Library dazzleYaml = Library.builder()
|
||||
.groupId("space.arim.dazzleconf")
|
||||
.artifactId("dazzleconf-ext-snakeyaml")
|
||||
.version("1.3.0-M1")
|
||||
.relocate(dazzleRelocation)
|
||||
.relocate(snakeYamlRelocation)
|
||||
.build();
|
||||
final Library snakeYaml = Library.builder()
|
||||
.groupId("org.yaml")
|
||||
.artifactId("snakeyaml")
|
||||
.version("1.30")
|
||||
.relocate(dazzleRelocation)
|
||||
.relocate(snakeYamlRelocation)
|
||||
.build();
|
||||
|
||||
manager.loadLibrary(snakeYaml);
|
||||
manager.loadLibrary(dazzleConf);
|
||||
manager.loadLibrary(dazzleYaml);
|
||||
}
|
||||
}
|
@ -3,9 +3,9 @@ plugins {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://repo.alessiodp.com/releases/")
|
||||
maven("https://jitpack.io")
|
||||
maven("https://repo.codemc.org/repository/maven-public/")
|
||||
maven("https://repo.alessiodp.com/releases/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -25,8 +25,11 @@ tasks {
|
||||
options.release.set(17)
|
||||
}
|
||||
|
||||
build {
|
||||
dependsOn(shadowJar)
|
||||
shadowJar {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
relocate("net.byteflux.libby", "me.adrianed.authmevelocity.libs.libby")
|
||||
relocate("space.arim.dazzleconf", "me.adrianed.authmevelocity.libs.dazzleconf")
|
||||
configurations = listOf(project.configurations.shadow.get())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,10 @@ import me.adrianed.authmevelocity.velocity.listener.FastLoginListener;
|
||||
import me.adrianed.authmevelocity.velocity.listener.PluginMessageListener;
|
||||
import me.adrianed.authmevelocity.velocity.listener.ProxyListener;
|
||||
import me.adrianed.authmevelocity.api.velocity.AuthMeVelocityAPI;
|
||||
import me.adrianed.authmevelocity.common.LibsManager;
|
||||
import me.adrianed.authmevelocity.common.configuration.Loader;
|
||||
import me.adrianed.authmevelocity.common.configuration.ProxyConfiguration;
|
||||
import com.google.inject.Inject;
|
||||
import com.moandjiezana.toml.Toml;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
@ -23,20 +23,15 @@ import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
|
||||
import net.byteflux.libby.VelocityLibraryManager;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -45,6 +40,7 @@ import java.util.UUID;
|
||||
name = "AuthMeVelocity",
|
||||
url = "https://github.com/4drian3d/AuthMeVelocity",
|
||||
description = "This plugin adds the support for AuthMeReloaded to Velocity",
|
||||
version = "3.0.0",
|
||||
dependencies = {
|
||||
@Dependency(
|
||||
id = "miniplaceholders",
|
||||
@ -64,7 +60,6 @@ public final class AuthMeVelocityPlugin implements AuthMeVelocityAPI {
|
||||
private final Path pluginDirectory;
|
||||
private Loader<ProxyConfiguration> config;
|
||||
|
||||
private final List<Object> listeners = new ArrayList<>(3);
|
||||
protected final Set<UUID> loggedPlayers = ConcurrentHashMap.newKeySet();
|
||||
|
||||
@Inject
|
||||
@ -76,9 +71,10 @@ public final class AuthMeVelocityPlugin implements AuthMeVelocityAPI {
|
||||
|
||||
@Subscribe
|
||||
public void onProxyInitialization(ProxyInitializeEvent event) {
|
||||
final VelocityLibraries libraries
|
||||
= new VelocityLibraries(logger, pluginDirectory, proxy.getPluginManager(), this);
|
||||
libraries.registerRepositories();
|
||||
final LibsManager libraries
|
||||
= new LibsManager(
|
||||
new VelocityLibraryManager<>(
|
||||
logger, pluginDirectory, proxy.getPluginManager(), this));
|
||||
libraries.loadLibraries();
|
||||
|
||||
this.config = Loader.create(pluginDirectory, "config.yml", ProxyConfiguration.class, logger);
|
||||
|
@ -1,57 +0,0 @@
|
||||
package me.adrianed.authmevelocity.velocity;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import com.velocitypowered.api.plugin.PluginManager;
|
||||
|
||||
import me.adrianed.authmevelocity.common.LibsManager;
|
||||
import net.byteflux.libby.Library;
|
||||
import net.byteflux.libby.VelocityLibraryManager;
|
||||
import net.byteflux.libby.relocation.Relocation;
|
||||
|
||||
public class VelocityLibraries implements LibsManager {
|
||||
private final VelocityLibraryManager<AuthMeVelocityPlugin> manager;
|
||||
|
||||
public VelocityLibraries(Logger logger, Path dataDirectory, PluginManager pluginManager, AuthMeVelocityPlugin plugin) {
|
||||
this.manager = new VelocityLibraryManager<AuthMeVelocityPlugin>(
|
||||
logger, dataDirectory, pluginManager, plugin);
|
||||
}
|
||||
@Override
|
||||
public void registerRepositories() {
|
||||
manager.addMavenCentral();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadLibraries() {
|
||||
final Relocation dazzleRelocation
|
||||
= new Relocation("space.arim.dazzleconf", "me.adrianed.authmevelocity.libs.dazzleconf");
|
||||
final Relocation snakeYamlRelocation
|
||||
= new Relocation("pattern", "me.adrianed.authmevelocity.libs.snake");
|
||||
final Library dazzleConf = Library.builder()
|
||||
.groupId("space.arim.dazzleconf")
|
||||
.artifactId("dazzleconf-ext-snakeyaml")
|
||||
.version("1.3.0-M1")
|
||||
.relocate(dazzleRelocation)
|
||||
.build();
|
||||
final Library dazzleYaml = Library.builder()
|
||||
.groupId("space.arim.dazzleconf")
|
||||
.artifactId("dazzleconf-ext-snakeyaml")
|
||||
.version("1.3.0-M1")
|
||||
.relocate(dazzleRelocation)
|
||||
.relocate(snakeYamlRelocation)
|
||||
.build();
|
||||
final Library snakeYaml = Library.builder()
|
||||
.groupId("org.yaml")
|
||||
.artifactId("snakeyaml")
|
||||
.version("1.30")
|
||||
.relocate(dazzleRelocation)
|
||||
.relocate(snakeYamlRelocation)
|
||||
.build();
|
||||
|
||||
manager.loadLibrary(snakeYaml);
|
||||
manager.loadLibrary(dazzleConf);
|
||||
manager.loadLibrary(dazzleYaml);
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
|
||||
import me.adrianed.authmevelocity.velocity.AuthMeVelocityPlugin;
|
||||
import me.adrianed.authmevelocity.api.velocity.AuthMeVelocityAPI;
|
||||
|
||||
public class ConnectListener {
|
||||
private final ProxyServer proxy;
|
||||
|
@ -12,8 +12,6 @@ import com.velocitypowered.api.event.player.PlayerChatEvent;
|
||||
import com.velocitypowered.api.event.player.TabCompleteEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
|
||||
public final class ProxyListener {
|
||||
|
Loading…
x
Reference in New Issue
Block a user