diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 5a3b233..82864db 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -31,7 +31,7 @@ authme = { module = "fr.xephi:authme", version.ref = "authme" }
libby-core = { group = "net.byteflux", name = "libby-core", version.ref = "libby" }
libby-bukkit = { group = "net.byteflux", name = "libby-bukkit", version.ref = "libby" }
-#libby-paper = "TODO"
+libby-paper = { group = "net.byteflux", name = "libby-paper", version.ref = "libby" }
libby-velocity = { group = "net.byteflux", name = "libby-velocity", version.ref = "libby" }
miniplaceholders = { group = "io.github.miniplaceholders", name = "miniplaceholders-api", version.ref = "miniplaceholders" }
diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts
index c644df4..e72b7c1 100644
--- a/paper/build.gradle.kts
+++ b/paper/build.gradle.kts
@@ -27,7 +27,7 @@ dependencies {
implementation(projects.authmevelocityApiPaper)
implementation(libs.libby.bukkit)
- //implementation(libs.libby.paper)
+ implementation(libs.libby.paper)
}
tasks {
diff --git a/paper/src/main/java/io/github/_4drian3d/authmevelocity/paper/AuthMeVelocityBootstrap.java b/paper/src/main/java/io/github/_4drian3d/authmevelocity/paper/AuthMeVelocityBootstrap.java
new file mode 100644
index 0000000..cd77547
--- /dev/null
+++ b/paper/src/main/java/io/github/_4drian3d/authmevelocity/paper/AuthMeVelocityBootstrap.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2023 AuthMeVelocity Contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package io.github._4drian3d.authmevelocity.paper;
+
+import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
+import io.papermc.paper.plugin.bootstrap.PluginProviderContext;
+import org.bukkit.plugin.java.JavaPlugin;
+import org.jetbrains.annotations.NotNull;
+
+@SuppressWarnings("all")
+public class AuthMeVelocityBootstrap implements PluginBootstrap {
+ @Override
+ public void bootstrap(@NotNull PluginProviderContext context) {
+
+ }
+
+ @Override
+ public @NotNull JavaPlugin createPlugin(@NotNull PluginProviderContext context) {
+ return new AuthMeVelocityPlugin(context.getDataDirectory());
+ }
+}
diff --git a/paper/src/main/java/io/github/_4drian3d/authmevelocity/paper/AuthMeVelocityPlugin.java b/paper/src/main/java/io/github/_4drian3d/authmevelocity/paper/AuthMeVelocityPlugin.java
index 6f4c489..5223d3d 100644
--- a/paper/src/main/java/io/github/_4drian3d/authmevelocity/paper/AuthMeVelocityPlugin.java
+++ b/paper/src/main/java/io/github/_4drian3d/authmevelocity/paper/AuthMeVelocityPlugin.java
@@ -26,25 +26,44 @@ import io.github._4drian3d.authmevelocity.common.configuration.PaperConfiguratio
import io.github._4drian3d.authmevelocity.paper.listeners.AuthMeListener;
import io.github._4drian3d.authmevelocity.paper.listeners.MessageListener;
import net.byteflux.libby.BukkitLibraryManager;
+import net.byteflux.libby.LibraryManager;
+import net.byteflux.libby.PaperLibraryManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
+import java.nio.file.Path;
import java.util.logging.Level;
public final class AuthMeVelocityPlugin extends JavaPlugin {
private static final String CHANNEL = "authmevelocity:main";
-
+ private final Path dataFolder;
private ConfigurationContainer config;
+ @SuppressWarnings("unused")
+ public AuthMeVelocityPlugin() {
+ this.dataFolder = getDataFolder().toPath();
+ }
+
+ public AuthMeVelocityPlugin(final Path dataFolder) {
+ this.dataFolder = dataFolder;
+ }
+
@Override
public void onEnable() {
- new LibsManager(new BukkitLibraryManager(this)).loadLibraries();
+ LibraryManager libraryManager;
+ try {
+ Class.forName("io.papermc.paper.plugin.bootstrap.PluginBootstrap");
+ libraryManager = new PaperLibraryManager(this);
+ } catch (ClassNotFoundException e) {
+ libraryManager = new BukkitLibraryManager(this);
+ }
+ new LibsManager(libraryManager).loadLibraries();
try {
- this.config = ConfigurationContainer.load(getDataFolder().toPath(), PaperConfiguration.class);
- } catch (Exception e) {
+ this.config = ConfigurationContainer.load(dataFolder, PaperConfiguration.class);
+ } catch (Throwable e) {
getLogger().log(Level.SEVERE, "Could not load config.conf file", e);
getServer().getPluginManager().disablePlugin(this);
return;
diff --git a/paper/src/main/java/io/github/_4drian3d/authmevelocity/paper/listeners/MessageListener.java b/paper/src/main/java/io/github/_4drian3d/authmevelocity/paper/listeners/MessageListener.java
index 6a002ba..6ee4549 100644
--- a/paper/src/main/java/io/github/_4drian3d/authmevelocity/paper/listeners/MessageListener.java
+++ b/paper/src/main/java/io/github/_4drian3d/authmevelocity/paper/listeners/MessageListener.java
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull;
public final class MessageListener implements PluginMessageListener {
private final AuthMeVelocityPlugin plugin;
- public MessageListener(AuthMeVelocityPlugin plugin) {
+ public MessageListener(final AuthMeVelocityPlugin plugin) {
this.plugin = plugin;
}
diff --git a/paper/src/main/resources/paper-plugin.yml b/paper/src/main/resources/paper-plugin.yml
new file mode 100644
index 0000000..270131c
--- /dev/null
+++ b/paper/src/main/resources/paper-plugin.yml
@@ -0,0 +1,17 @@
+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
+api-version: '1.19'
+folia-supported: true
+dependencies:
+ - name: MiniPlaceholders
+ required: false
+ bootstrap: false
+ - name: AuthMe
+ required: true
+ bootstrap: false