fix: Fixed Session Support and removed legacy support
This commit is contained in:
parent
e7c246bc1f
commit
9d452e6c32
@ -12,9 +12,9 @@ tasks {
|
|||||||
(options as StandardJavadocDocletOptions).run {
|
(options as StandardJavadocDocletOptions).run {
|
||||||
encoding = Charsets.UTF_8.name()
|
encoding = Charsets.UTF_8.name()
|
||||||
links(
|
links(
|
||||||
"https://jd.advntr.dev/api/4.12.0/",
|
"https://jd.advntr.dev/api/${libs.versions.adventure.get()}/",
|
||||||
"https://jd.advntr.dev/text-minimessage/4.12.0/",
|
"https://jd.advntr.dev/text-minimessage/${libs.versions.adventure.get()}/",
|
||||||
"https://jd.papermc.io/paper/1.19/"
|
"https://jd.papermc.io/paper/1.20/"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
package io.github._4drian3d.authmevelocity.api.paper.event;
|
package io.github._4drian3d.authmevelocity.api.paper.event;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@ -36,7 +37,7 @@ public final class PreSendLoginEvent extends PlayerEvent implements Cancellable
|
|||||||
* @param player the player to be sent
|
* @param player the player to be sent
|
||||||
*/
|
*/
|
||||||
public PreSendLoginEvent(@NotNull Player player) {
|
public PreSendLoginEvent(@NotNull Player player) {
|
||||||
super(player);
|
super(player, !Bukkit.isPrimaryThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
allprojects {
|
allprojects {
|
||||||
apply<JavaPlugin>()
|
apply<JavaPlugin>()
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
tasks.withType<JavaCompile> {
|
||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
options.release.set(17)
|
options.release.set(17)
|
||||||
|
@ -4,10 +4,6 @@ plugins {
|
|||||||
id("authmevelocity.spotless")
|
id("authmevelocity.spotless")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven("https://repo.alessiodp.com/releases/")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(libs.configurate.hocon)
|
compileOnly(libs.configurate.hocon)
|
||||||
compileOnly(libs.libby.core)
|
compileOnly(libs.libby.core)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
group = io.github.4drian3d
|
group = io.github.4drian3d
|
||||||
version = 4.0.5-SNAPSHOT
|
version = 4.1.0-SNAPSHOT
|
||||||
description = AuthMeReloaded Support for Velocity
|
description = AuthMeReloaded Support for Velocity
|
||||||
url = https://modrinth.com/plugin/authmevelocity
|
url = https://modrinth.com/plugin/authmevelocity
|
||||||
id = authmevelocity
|
id = authmevelocity
|
||||||
|
@ -2,8 +2,8 @@ metadata.format.version = "1.1"
|
|||||||
|
|
||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
velocity = "3.2.0-SNAPSHOT"
|
velocity = "3.3.0-SNAPSHOT"
|
||||||
paper = "1.20-R0.1-SNAPSHOT"
|
paper = "1.20.4-R0.1-SNAPSHOT"
|
||||||
miniplaceholders = "2.2.3"
|
miniplaceholders = "2.2.3"
|
||||||
fastlogin = "1.12-SNAPSHOT"
|
fastlogin = "1.12-SNAPSHOT"
|
||||||
authme = "5.6.0-SNAPSHOT"
|
authme = "5.6.0-SNAPSHOT"
|
||||||
@ -29,7 +29,7 @@ adventure = { group = "net.kyori", name = "adventure-api", version.ref = "advent
|
|||||||
|
|
||||||
paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
|
paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
|
||||||
velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
|
velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
|
||||||
velocity-proxy = { group = "com.velocitypowered", name = "velocity-proxy", version.ref = "velocity" }
|
velocity-proxy = { group = "com.velocitypowered", name = "velocity-proxy", version = "3.2.0-SNAPSHOT" }
|
||||||
authme = { module = "fr.xephi:authme", version.ref = "authme" }
|
authme = { module = "fr.xephi:authme", version.ref = "authme" }
|
||||||
|
|
||||||
libby-core = { group = "net.byteflux", name = "libby-core", version.ref = "libby" }
|
libby-core = { group = "net.byteflux", name = "libby-core", version.ref = "libby" }
|
||||||
|
@ -4,19 +4,6 @@ plugins {
|
|||||||
id("authmevelocity.spotless")
|
id("authmevelocity.spotless")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven("https://repo.codemc.org/repository/maven-public/") {
|
|
||||||
mavenContent {
|
|
||||||
includeGroup("fr.xephi")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
maven("https://repo.alessiodp.com/releases/"){
|
|
||||||
mavenContent {
|
|
||||||
includeGroup("net.byteflux")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(libs.paper)
|
compileOnly(libs.paper)
|
||||||
compileOnly(libs.authme)
|
compileOnly(libs.authme)
|
||||||
@ -26,7 +13,6 @@ dependencies {
|
|||||||
implementation(projects.authmevelocityCommon)
|
implementation(projects.authmevelocityCommon)
|
||||||
implementation(projects.authmevelocityApiPaper)
|
implementation(projects.authmevelocityApiPaper)
|
||||||
|
|
||||||
implementation(libs.libby.bukkit)
|
|
||||||
implementation(libs.libby.paper)
|
implementation(libs.libby.paper)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,10 +29,10 @@ tasks {
|
|||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
}
|
}
|
||||||
runServer {
|
runServer {
|
||||||
minecraftVersion("1.19.4")
|
minecraftVersion("1.20.4")
|
||||||
}
|
}
|
||||||
processResources {
|
processResources {
|
||||||
filesMatching(listOf("paper-plugin.yml", "plugin.yml")) {
|
filesMatching("paper-plugin.yml") {
|
||||||
expand("version" to project.version)
|
expand("version" to project.version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,48 +25,38 @@ import io.github._4drian3d.authmevelocity.common.configuration.ConfigurationCont
|
|||||||
import io.github._4drian3d.authmevelocity.common.configuration.PaperConfiguration;
|
import io.github._4drian3d.authmevelocity.common.configuration.PaperConfiguration;
|
||||||
import io.github._4drian3d.authmevelocity.paper.listeners.AuthMeListener;
|
import io.github._4drian3d.authmevelocity.paper.listeners.AuthMeListener;
|
||||||
import io.github._4drian3d.authmevelocity.paper.listeners.MessageListener;
|
import io.github._4drian3d.authmevelocity.paper.listeners.MessageListener;
|
||||||
import net.byteflux.libby.BukkitLibraryManager;
|
|
||||||
import net.byteflux.libby.LibraryManager;
|
import net.byteflux.libby.LibraryManager;
|
||||||
import net.byteflux.libby.PaperLibraryManager;
|
import net.byteflux.libby.PaperLibraryManager;
|
||||||
|
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
|
||||||
|
|
||||||
public final class AuthMeVelocityPlugin extends JavaPlugin {
|
public final class AuthMeVelocityPlugin extends JavaPlugin {
|
||||||
private static final String CHANNEL = "authmevelocity:main";
|
private static final String CHANNEL = "authmevelocity:main";
|
||||||
private final Path dataFolder;
|
private final Path dataFolder;
|
||||||
|
private ComponentLogger componentLogger;
|
||||||
private ConfigurationContainer<PaperConfiguration> config;
|
private ConfigurationContainer<PaperConfiguration> config;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public AuthMeVelocityPlugin() {
|
|
||||||
this.dataFolder = getDataFolder().toPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthMeVelocityPlugin(final Path dataFolder) {
|
public AuthMeVelocityPlugin(final Path dataFolder) {
|
||||||
this.dataFolder = dataFolder;
|
this.dataFolder = dataFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
LibraryManager libraryManager;
|
this.componentLogger = getComponentLogger();
|
||||||
try {
|
final LibraryManager libraryManager = new PaperLibraryManager(this);
|
||||||
Class.forName("io.papermc.paper.plugin.bootstrap.PluginBootstrap");
|
|
||||||
libraryManager = new PaperLibraryManager(this);
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
libraryManager = new BukkitLibraryManager(this);
|
|
||||||
this.getLogger().warning("You are using Spigot or a very old version of the platform you are using."
|
|
||||||
+"\nIn the future AuthMeVelocity will no longer support this version. Consider upgrading to Paper 1.19.4+.");
|
|
||||||
}
|
|
||||||
new LibsManager(libraryManager).loadLibraries();
|
new LibsManager(libraryManager).loadLibraries();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.config = ConfigurationContainer.load(dataFolder, PaperConfiguration.class);
|
this.config = ConfigurationContainer.load(dataFolder, PaperConfiguration.class);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
this.getLogger().log(Level.SEVERE, "Could not load config.conf file", e);
|
componentLogger.error("Could not load config.conf file", e);
|
||||||
this.getServer().getPluginManager().disablePlugin(this);
|
this.getServer().getPluginManager().disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -81,7 +71,7 @@ public final class AuthMeVelocityPlugin extends JavaPlugin {
|
|||||||
AuthMePlaceholders.getExpansion().register();
|
AuthMePlaceholders.getExpansion().register();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getLogger().info("AuthMeVelocity enabled");
|
componentLogger.info(miniMessage().deserialize("<gradient:aqua:dark_aqua>AuthMeVelocity</gradient> <aqua>enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -89,7 +79,7 @@ public final class AuthMeVelocityPlugin extends JavaPlugin {
|
|||||||
this.getServer().getMessenger().unregisterOutgoingPluginChannel(this, CHANNEL);
|
this.getServer().getMessenger().unregisterOutgoingPluginChannel(this, CHANNEL);
|
||||||
this.getServer().getMessenger().unregisterIncomingPluginChannel(this, CHANNEL);
|
this.getServer().getMessenger().unregisterIncomingPluginChannel(this, CHANNEL);
|
||||||
|
|
||||||
this.getLogger().info("AuthMeVelocity disabled");
|
componentLogger.info(miniMessage().deserialize("<gradient:aqua:dark_aqua>AuthMeVelocity</gradient> <red>disabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMessageToProxy(
|
public void sendMessageToProxy(
|
||||||
@ -97,16 +87,16 @@ public final class AuthMeVelocityPlugin extends JavaPlugin {
|
|||||||
final @NotNull MessageType type,
|
final @NotNull MessageType type,
|
||||||
final @NotNull String playerName
|
final @NotNull String playerName
|
||||||
) {
|
) {
|
||||||
@SuppressWarnings("UnstableApiUsage") final ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
final ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
out.writeUTF(type.toString());
|
out.writeUTF(type.toString());
|
||||||
out.writeUTF(playerName);
|
out.writeUTF(playerName);
|
||||||
|
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
logDebug("MessageToProxy | Null Player, Player Name: " + playerName);
|
|
||||||
Bukkit.getServer().sendPluginMessage(this, CHANNEL, out.toByteArray());
|
Bukkit.getServer().sendPluginMessage(this, CHANNEL, out.toByteArray());
|
||||||
|
logDebug("MessageToProxy | Null Player, Player Name: " + playerName);
|
||||||
} else {
|
} else {
|
||||||
logDebug("MessageToProxy | Player Present: " + player.getName() + ", Player Name: " + playerName);
|
|
||||||
player.sendPluginMessage(this, CHANNEL, out.toByteArray());
|
player.sendPluginMessage(this, CHANNEL, out.toByteArray());
|
||||||
|
logDebug("MessageToProxy | Player Present: " + player.getName() + ", Player Name: " + playerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +109,7 @@ public final class AuthMeVelocityPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
public void logDebug(String debug) {
|
public void logDebug(String debug) {
|
||||||
if (config.get().debug()) {
|
if (config.get().debug()) {
|
||||||
getLogger().info("[DEBUG] " + debug);
|
componentLogger.info("[DEBUG] " + debug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,16 +21,17 @@ import fr.xephi.authme.events.*;
|
|||||||
import io.github._4drian3d.authmevelocity.api.paper.event.PreSendLoginEvent;
|
import io.github._4drian3d.authmevelocity.api.paper.event.PreSendLoginEvent;
|
||||||
import io.github._4drian3d.authmevelocity.common.MessageType;
|
import io.github._4drian3d.authmevelocity.common.MessageType;
|
||||||
import io.github._4drian3d.authmevelocity.paper.AuthMeVelocityPlugin;
|
import io.github._4drian3d.authmevelocity.paper.AuthMeVelocityPlugin;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public final class AuthMeListener implements Listener {
|
public final class AuthMeListener implements Listener {
|
||||||
private final AuthMeVelocityPlugin plugin;
|
private final AuthMeVelocityPlugin plugin;
|
||||||
|
|
||||||
public AuthMeListener(AuthMeVelocityPlugin plugin) {
|
public AuthMeListener(final AuthMeVelocityPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,14 +40,12 @@ public final class AuthMeListener implements Listener {
|
|||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
plugin.logDebug("LoginEvent | Start");
|
plugin.logDebug("LoginEvent | Start");
|
||||||
|
|
||||||
// I hate this, but... Spigot compatibility ¯\_(ツ)_/¯
|
plugin.getServer().getAsyncScheduler().runDelayed(plugin, task -> {
|
||||||
final var preSendLoginEvent = new PreSendLoginEvent(player);
|
if (new PreSendLoginEvent(player).callEvent()) {
|
||||||
Bukkit.getPluginManager().callEvent(preSendLoginEvent);
|
plugin.sendMessageToProxy(player, MessageType.LOGIN, player.getName());
|
||||||
|
plugin.logDebug("LoginEvent | PreSendLoginEvent allowed");
|
||||||
if (!preSendLoginEvent.isCancelled()) {
|
}
|
||||||
plugin.sendMessageToProxy(player, MessageType.LOGIN, player.getName());
|
}, 1, TimeUnit.SECONDS);
|
||||||
plugin.logDebug("LoginEvent | PreSendLoginEvent allowed");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
@ -54,14 +53,12 @@ public final class AuthMeListener implements Listener {
|
|||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
plugin.logDebug("RestoreSessionEvent | Start");
|
plugin.logDebug("RestoreSessionEvent | Start");
|
||||||
|
|
||||||
// I hate this, but... Spigot compatibility ¯\_(ツ)_/¯
|
plugin.getServer().getAsyncScheduler().runDelayed(plugin, task -> {
|
||||||
final var preSendLoginEvent = new PreSendLoginEvent(player);
|
if (new PreSendLoginEvent(player).callEvent()) {
|
||||||
Bukkit.getPluginManager().callEvent(preSendLoginEvent);
|
plugin.sendMessageToProxy(player, MessageType.LOGIN, player.getName());
|
||||||
|
plugin.logDebug("RestoreSessionEvent | PreSendLoginEvent allowed");
|
||||||
if (!preSendLoginEvent.isCancelled()) {
|
}
|
||||||
plugin.sendMessageToProxy(player, MessageType.LOGIN, player.getName());
|
}, 1, TimeUnit.SECONDS);
|
||||||
plugin.logDebug("RestoreSessionEvent | PreSendLoginEvent allowed");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -42,7 +42,6 @@ public final class MessageListener implements PluginMessageListener {
|
|||||||
final byte @NotNull [] bytes
|
final byte @NotNull [] bytes
|
||||||
) {
|
) {
|
||||||
if (identifier.equals("authmevelocity:main")) {
|
if (identifier.equals("authmevelocity:main")) {
|
||||||
@SuppressWarnings("UnstableApiUsage")
|
|
||||||
final ByteArrayDataInput input = ByteStreams.newDataInput(bytes);
|
final ByteArrayDataInput input = ByteStreams.newDataInput(bytes);
|
||||||
|
|
||||||
final String data = input.readUTF();
|
final String data = input.readUTF();
|
||||||
|
@ -10,9 +10,10 @@ website: https://modrinth.com/plugin/authmevelocity
|
|||||||
api-version: '1.19'
|
api-version: '1.19'
|
||||||
folia-supported: true
|
folia-supported: true
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: MiniPlaceholders
|
server:
|
||||||
required: false
|
MiniPlaceholders:
|
||||||
bootstrap: false
|
required: false
|
||||||
- name: AuthMe
|
load: BEFORE
|
||||||
required: true
|
AuthMe:
|
||||||
bootstrap: false
|
required: true
|
||||||
|
load: BEFORE
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
name: AuthMeVelocity
|
|
||||||
version: "${version}"
|
|
||||||
main: io.github._4drian3d.authmevelocity.paper.AuthMeVelocityPlugin
|
|
||||||
description: AuthMeReloaded Support for Velocity
|
|
||||||
authors:
|
|
||||||
- xQuickGlare
|
|
||||||
- 4drian3d
|
|
||||||
website: https://modrinth.com/plugin/authmevelocity
|
|
||||||
depend:
|
|
||||||
- AuthMe
|
|
||||||
api-version: 1.13
|
|
||||||
folia-supported: true
|
|
||||||
softdepend:
|
|
||||||
- MiniPlaceholders
|
|
@ -1,3 +1,4 @@
|
|||||||
|
@file:Suppress("UnstableApiUsage")
|
||||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||||
|
|
||||||
rootProject.name = "authmevelocity-parent"
|
rootProject.name = "authmevelocity-parent"
|
||||||
@ -19,4 +20,24 @@ pluginManagement {
|
|||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
maven("https://papermc.io/repo/repository/maven-public/")
|
||||||
|
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
|
||||||
|
maven("https://repo.codemc.org/repository/maven-public/") {
|
||||||
|
mavenContent {
|
||||||
|
includeGroup("com.github.games647")
|
||||||
|
includeGroup("fr.xephi")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maven("https://repo.alessiodp.com/releases/") {
|
||||||
|
mavenContent {
|
||||||
|
includeGroup("net.byteflux")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maven("https://maven.elytrium.net/repo/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4,20 +4,6 @@ plugins {
|
|||||||
id("authmevelocity.spotless")
|
id("authmevelocity.spotless")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven("https://repo.codemc.org/repository/maven-public/") {
|
|
||||||
mavenContent {
|
|
||||||
includeGroup("com.github.games647")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
maven("https://repo.alessiodp.com/releases/") {
|
|
||||||
mavenContent {
|
|
||||||
includeGroup("net.byteflux")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
maven("https://maven.elytrium.net/repo/")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(libs.velocity.api)
|
compileOnly(libs.velocity.api)
|
||||||
compileOnly(libs.velocity.proxy)
|
compileOnly(libs.velocity.proxy)
|
||||||
@ -31,7 +17,6 @@ dependencies {
|
|||||||
implementation(projects.authmevelocityCommon)
|
implementation(projects.authmevelocityCommon)
|
||||||
implementation(projects.authmevelocityApiVelocity)
|
implementation(projects.authmevelocityApiVelocity)
|
||||||
|
|
||||||
implementation(libs.libby.velocity)
|
|
||||||
implementation(libs.bstats.velocity)
|
implementation(libs.bstats.velocity)
|
||||||
|
|
||||||
testImplementation(platform("org.junit:junit-bom:5.10.1"))
|
testImplementation(platform("org.junit:junit-bom:5.10.1"))
|
||||||
@ -47,9 +32,6 @@ tasks {
|
|||||||
archiveClassifier.set("")
|
archiveClassifier.set("")
|
||||||
|
|
||||||
relocate("org.bstats", "io.github._4drian3d.authmevelocity.libs.bstats")
|
relocate("org.bstats", "io.github._4drian3d.authmevelocity.libs.bstats")
|
||||||
relocate("net.byteflux.libby", "io.github._4drian3d.authmevelocity.libs.libby")
|
|
||||||
relocate("org.spongepowered", "io.github._4drian3d.authmevelocity.libs.sponge")
|
|
||||||
relocate("io.leangen.geantyref", "io.github._4drian3d.authmevelocity.libs.geantyref")
|
|
||||||
}
|
}
|
||||||
build {
|
build {
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
|
@ -19,7 +19,6 @@ package io.github._4drian3d.authmevelocity.velocity;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.velocitypowered.api.command.CommandSource;
|
|
||||||
import com.velocitypowered.api.event.Subscribe;
|
import com.velocitypowered.api.event.Subscribe;
|
||||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||||
import com.velocitypowered.api.plugin.Dependency;
|
import com.velocitypowered.api.plugin.Dependency;
|
||||||
@ -35,7 +34,6 @@ import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
|||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||||
import io.github._4drian3d.authmevelocity.api.velocity.AuthMeVelocityAPI;
|
import io.github._4drian3d.authmevelocity.api.velocity.AuthMeVelocityAPI;
|
||||||
import io.github._4drian3d.authmevelocity.common.Constants;
|
import io.github._4drian3d.authmevelocity.common.Constants;
|
||||||
import io.github._4drian3d.authmevelocity.common.LibsManager;
|
|
||||||
import io.github._4drian3d.authmevelocity.common.configuration.ConfigurationContainer;
|
import io.github._4drian3d.authmevelocity.common.configuration.ConfigurationContainer;
|
||||||
import io.github._4drian3d.authmevelocity.common.configuration.ProxyConfiguration;
|
import io.github._4drian3d.authmevelocity.common.configuration.ProxyConfiguration;
|
||||||
import io.github._4drian3d.authmevelocity.velocity.commands.AuthMeCommand;
|
import io.github._4drian3d.authmevelocity.velocity.commands.AuthMeCommand;
|
||||||
@ -52,12 +50,10 @@ import io.github._4drian3d.authmevelocity.velocity.listener.input.ChatListener;
|
|||||||
import io.github._4drian3d.authmevelocity.velocity.listener.input.CommandListener;
|
import io.github._4drian3d.authmevelocity.velocity.listener.input.CommandListener;
|
||||||
import io.github._4drian3d.authmevelocity.velocity.listener.input.CompletionPacketListener;
|
import io.github._4drian3d.authmevelocity.velocity.listener.input.CompletionPacketListener;
|
||||||
import io.github._4drian3d.authmevelocity.velocity.listener.input.TabCompleteListener;
|
import io.github._4drian3d.authmevelocity.velocity.listener.input.TabCompleteListener;
|
||||||
import net.byteflux.libby.VelocityLibraryManager;
|
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
|
||||||
import org.bstats.charts.SimplePie;
|
import org.bstats.charts.SimplePie;
|
||||||
import org.bstats.velocity.Metrics;
|
import org.bstats.velocity.Metrics;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -67,6 +63,8 @@ import java.util.function.Predicate;
|
|||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
|
||||||
|
|
||||||
@Plugin(
|
@Plugin(
|
||||||
id = "authmevelocity",
|
id = "authmevelocity",
|
||||||
name = "AuthMeVelocity",
|
name = "AuthMeVelocity",
|
||||||
@ -103,7 +101,7 @@ public final class AuthMeVelocityPlugin implements AuthMeVelocityAPI {
|
|||||||
@Inject
|
@Inject
|
||||||
private PluginManager pluginManager;
|
private PluginManager pluginManager;
|
||||||
@Inject
|
@Inject
|
||||||
private Logger logger;
|
private ComponentLogger logger;
|
||||||
@Inject
|
@Inject
|
||||||
@DataDirectory
|
@DataDirectory
|
||||||
private Path pluginDirectory;
|
private Path pluginDirectory;
|
||||||
@ -117,12 +115,6 @@ public final class AuthMeVelocityPlugin implements AuthMeVelocityAPI {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onProxyInitialization(ProxyInitializeEvent event) {
|
public void onProxyInitialization(ProxyInitializeEvent event) {
|
||||||
final LibsManager libraries
|
|
||||||
= new LibsManager(
|
|
||||||
new VelocityLibraryManager<>(
|
|
||||||
logger, pluginDirectory, pluginManager, this));
|
|
||||||
libraries.loadLibraries();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.config = ConfigurationContainer.load(pluginDirectory, ProxyConfiguration.class);
|
this.config = ConfigurationContainer.load(pluginDirectory, ProxyConfiguration.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -179,13 +171,10 @@ public final class AuthMeVelocityPlugin implements AuthMeVelocityAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sendInfoMessage() {
|
public void sendInfoMessage() {
|
||||||
final CommandSource source = proxy.getConsoleCommandSource();
|
logger.info(miniMessage().deserialize(" <gray>--- <gradient:aqua:dark_aqua>AuthMeVelocity</gradient> ---"));
|
||||||
source.sendMessage(MiniMessage.miniMessage().deserialize(
|
logger.info(miniMessage().deserialize("<gray>AuthServers: <green>" + config.get().authServers()));
|
||||||
" <gray>--- <aqua>AuthMeVelocity</aqua> ---"));
|
|
||||||
source.sendMessage(MiniMessage.miniMessage().deserialize(
|
|
||||||
"<gray>AuthServers: <green>" + config.get().authServers()));
|
|
||||||
if (config.get().sendOnLogin().sendToServerOnLogin()) {
|
if (config.get().sendOnLogin().sendToServerOnLogin()) {
|
||||||
source.sendMessage(MiniMessage.miniMessage().deserialize(
|
logger.info(miniMessage().deserialize(
|
||||||
"<gray>LobbyServers: <green>" + config.get().sendOnLogin().teleportServers()));
|
"<gray>LobbyServers: <green>" + config.get().sendOnLogin().teleportServers()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,9 @@ public final class PluginMessageListener implements Listener<PluginMessageEvent>
|
|||||||
@Override
|
@Override
|
||||||
public EventTask executeAsync(final PluginMessageEvent event) {
|
public EventTask executeAsync(final PluginMessageEvent event) {
|
||||||
return EventTask.async(() -> {
|
return EventTask.async(() -> {
|
||||||
|
plugin.logDebug(() -> "PluginMessageEvent | Start");
|
||||||
if (notAllowedEvent(event)) {
|
if (notAllowedEvent(event)) {
|
||||||
plugin.logDebug("PluginMessageEvent | Not allowed");
|
plugin.logDebug(() -> "PluginMessageEvent | Not allowed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user