Skip to content
Selena Rose Hammond edited this page Mar 13, 2024 · 7 revisions

Adding the API to your plugin

To add the API to your plugin you must first add it into your Gradle or Maven project
Be sure to shadow/shade the lib into your plugin.

Latest version

Maven

<repository>
  <id>selena-repos-releases</id>
  <name>Selena Repositories</name>
  <url>https://repo.selenadevelopment.com/releases</url>
</repository>
<dependency>
  <groupId>dev.selena.lua</groupId>
  <artifactId>LuaCore</artifactId>
  <version>VERSION</version>
</dependency>
<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
 </build>

Gradle groovy

repositories {
// ...
   maven {
      name "selenaReposReleases"
      url "https://repo.selenadevelopment.com/releases"
   }
// ...
}
dependencies {
// ...
   implementation "dev.selena.lua:LuaCore:VERSION"
// ...
}
plugins {
    // ...
    id 'com.github.johnrengelman.shadow' version '7.1.2'
    // ...
}
// ...
apply plugin: 'java'
// ...
// Note, This is just the method that works for me
shadowJar {

    dependsOn(jar)
    archiveName = rootProject.name + ".jar"
    dependencies {
        include(dependency('dev.selena.lua:LuaCore'))
    }
    relocate 'dev.selena', 'NEW.LOCATION'

    zip64 true
    subprojects.each { subproject ->
        from subproject.sourceSets.main.output.classesDirs
        from subproject.sourceSets.main.output.resourcesDir
    }

    configurations = [project.configurations.getByName("runtimeClasspath")]
}

Gradle kotlin

repositories {
// ...
   maven {
      name = "selenaReposReleases"
      url = uri("https://repo.selenadevelopment.com/releases")
   }
// ...
}
dependencies {
// ...
   implementation("dev.selena.lua:LuaCore:VERSION")
// ...
}
// Note, This section is untested. I have not used kotlin for this 
plugins {
    // ...
    id("com.github.johnrengelman.shadow") version "7.1.2"
    // ...
}
// ...
apply(plugin = "java")
// ...
// Note, This is just the method that works for me
shadowJar {

    dependsOn(jar)
    archiveName = rootProject.name + ".jar"
    dependencies {
        include(dependency("dev.selena.lua:LuaCore"))
    }
    relocate "dev.selena", "NEW.LOCATION"

    zip64 true
    subprojects.each { subproject ->
        from subproject.sourceSets.main.output.classesDirs
        from subproject.sourceSets.main.output.resourcesDir
    }

    configurations = listOf(project.configurations.getByName("runtimeClasspath"))
}

Note, at times there seems to be an issue with IridiumColorAPI and NBTApi (working on resolving this)

for now you may need to add the following

<repository>
    <id>codemc-repo</id>
    <url>https://repo.codemc.io/repository/maven-public/</url>
    <layout>default</layout>
</repository>
<repository>
    <id>iridium</id>
    <url>https://nexus.iridiumdevelopment.net/repository/maven-releases/</url>
    <layout>default</layout>
</repository>
maven {
    url "https://repo.codemc.io/repository/maven-public/"
}
maven {
    url "https://nexus.iridiumdevelopment.net/repository/maven-releases/"
}