Skip to content

Commit

Permalink
[ci-skip] Use library loader
Browse files Browse the repository at this point in the history
  • Loading branch information
ryderbelserion committed Apr 21, 2024
1 parent fa4ca8d commit 27e0fc9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
12 changes: 5 additions & 7 deletions paper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -52,9 +52,7 @@ tasks {

shadowJar {
listOf(
"dev.triumphteam",
//"org.bstats",
"ch.jalu"
"com.ryderbelserion.vital"
).forEach { relocate(it, "libs.$it") }
}

Expand Down
26 changes: 26 additions & 0 deletions paper/src/main/java/com/badbones69/crazycrates/LibraryLoader.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
2 changes: 2 additions & 0 deletions paper/src/main/resources/paper-plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: '${name}'
main: '${group}.CrazyCrates'

loader: '${group}.LibraryLoader'

version: '${version}'
api-version: '1.20'
description: '${description}'
Expand Down

0 comments on commit 27e0fc9

Please sign in to comment.