Skip to content

1.1

Compare
Choose a tag to compare
@itsTyrion itsTyrion released this 28 Nov 23:04
· 9 commits to master since this release
33ae55d

Added support for the libraries property so the SpigotLibraryLoader can be used on Spigot-based servers (Spigot/Paper/Pufferfish/Purpur).

KEEP IN MIND THIS FEATURE WAS ADDED IN 1.17.1 SO IT DOES NOT WORK ON OLDER VERSIONS!
My testing was also NOT extensive, the "smoke test" passed, though.

To use it, create a new dependency config like so:

configurations {
    spigotLib
    compileOnly { extendsFrom spigotLib }
}

(The name is up to you, I used spigotLib here)
change the dependency you want to load this way from implementation (or compileOnly, if you used a different method before) to the config name of your choice like so:

spigotLib 'com.google.inject:guice:7.0.0' // example dependency

and pass dependencies of that config to this processor:

// Kotlin example
kapt.arguments {
    // Add other annotation processor arguments as/if needed - this example includes what I personally use for the version.
    arg 'mcPluginVersion', version.contains("SNAPSHOT") ? (version + new Date().format('yyyyMMdd_HHmm')) : version
    arg 'spigotLibraries', configurations.spigotLib.dependencies.collect { "$it.group:$it.name:$it.version" }.join(';')
}

// Java example
tasks.withType(JavaCompile).configureEach {
    // Add other annotation processor arguments as/if needed - this example includes what I personally use for the version.
    def versionString = version.contains("SNAPSHOT") ? (version + new Date().format('yyyyMMdd_HHmm')) : version
    options.compilerArgs += ('-Aproject.version=' + versionString)
   options.compilerArgs += '-AspigotLibraries=' + configurations.spigotLib.dependencies.collect { "$it.group:$it.name:$it.version" }.join(';')
}