From 27e0fc9868711384a26ce43588af08f9bd3e5e6f Mon Sep 17 00:00:00 2001 From: Ryder Belserion Date: Sat, 20 Apr 2024 21:41:34 -0400 Subject: [PATCH] [ci-skip] Use library loader --- paper/build.gradle.kts | 12 ++++----- .../badbones69/crazycrates/LibraryLoader.java | 26 +++++++++++++++++++ paper/src/main/resources/paper-plugin.yml | 2 ++ 3 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 paper/src/main/java/com/badbones69/crazycrates/LibraryLoader.java diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts index ceee1f963..47b8aabb9 100644 --- a/paper/build.gradle.kts +++ b/paper/build.gradle.kts @@ -11,13 +11,13 @@ dependencies { implementation(project(":api")) - implementation(libs.triumph.cmds) + implementation(libs.vital) - implementation(libs.config.me) + compileOnly(libs.triumph.cmds) - //implementation(libs.metrics) + compileOnly(libs.config.me) - implementation(libs.vital) + //compileOnly(libs.metrics) compileOnly(libs.head.database.api) @@ -52,9 +52,7 @@ tasks { shadowJar { listOf( - "dev.triumphteam", - //"org.bstats", - "ch.jalu" + "com.ryderbelserion.vital" ).forEach { relocate(it, "libs.$it") } } diff --git a/paper/src/main/java/com/badbones69/crazycrates/LibraryLoader.java b/paper/src/main/java/com/badbones69/crazycrates/LibraryLoader.java new file mode 100644 index 000000000..b34f967a4 --- /dev/null +++ b/paper/src/main/java/com/badbones69/crazycrates/LibraryLoader.java @@ -0,0 +1,26 @@ +package com.badbones69.crazycrates; + +import io.papermc.paper.plugin.loader.PluginClasspathBuilder; +import io.papermc.paper.plugin.loader.PluginLoader; +import io.papermc.paper.plugin.loader.library.impl.MavenLibraryResolver; +import org.eclipse.aether.artifact.DefaultArtifact; +import org.eclipse.aether.graph.Dependency; +import org.eclipse.aether.repository.RemoteRepository; +import org.jetbrains.annotations.NotNull; + +public class LibraryLoader implements PluginLoader { + + @Override + public void classloader(@NotNull PluginClasspathBuilder classpathBuilder) { + MavenLibraryResolver resolver = new MavenLibraryResolver(); + + resolver.addDependency(new Dependency(new DefaultArtifact("dev.triumphteam:triumph-cmd-bukkit:2.0.0-SNAPSHOT"), null)); + + resolver.addDependency(new Dependency(new DefaultArtifact("ch.jalu:configme:1.4.1"), null)); + + resolver.addRepository(new RemoteRepository.Builder("triumphteam", "default", "https://repo.triumphteam.dev/snapshots/").build()); + resolver.addRepository(new RemoteRepository.Builder("paper", "default", "https://repo.papermc.io/repository/maven-public/").build()); + + classpathBuilder.addLibrary(resolver); + } +} \ No newline at end of file diff --git a/paper/src/main/resources/paper-plugin.yml b/paper/src/main/resources/paper-plugin.yml index bea56e374..cd4571c81 100644 --- a/paper/src/main/resources/paper-plugin.yml +++ b/paper/src/main/resources/paper-plugin.yml @@ -1,6 +1,8 @@ name: '${name}' main: '${group}.CrazyCrates' +loader: '${group}.LibraryLoader' + version: '${version}' api-version: '1.20' description: '${description}'