Skip to content
JOO200 edited this page Mar 22, 2019 · 23 revisions

Gradle

First you will need to add the repositories (you should already have Spigot) and the dependency to your build.gradle. You will also need to shadow the library into your plugin jar.

plugins {
    id 'com.github.johnrengelman.shadow' version '4.0.4'
    id 'java'
}

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8

repositories {
    maven { url = "https://repo.aikar.co/content/groups/aikar/" }
    maven { url = "https://hub.spigotmc.org/nexus/content/groups/public/" }
}

compileJava {
    options.compilerArgs += ["-parameters"]
    options.fork = true
    options.forkOptions.executable = 'javac'
}

dependencies {
    compileOnly "org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT"
    compile "co.aikar:acf-core:[ACF VERSION]"
}

shadowJar {
   relocate 'co.aikar.commands', '[YOUR PLUGIN PACKAGE].acf'
}

build.dependsOn shadowJar

Replace [ACF VERSION] with the latest version found on the ACF Repo

Replace [YOUR PLUGIN PACKAGE] with a package to your plugin so that ACF is relocated to it.

Replace the spigot-api version with your version. Make sure to use compileOnly for runtime dependencies. Don't use compile, this will shade the dependency without relocation in your jar.

Enabling -parameters on the compiler lets ACF automatically generate Syntax messages for you using the parameter names. If you do not set this, syntax messages will use confusing names.

If you have kotlin, add this:

compileKotlin {
    kotlinOptions.javaParameters = true
}