Skip to content

Plugin configuration

Plugins are configured at the project level. Each plugin is built from exactly one Gradle source set (if you only have main, this will be the default and specifying it is optional). You must configure at least a main entrypoint class for your plugin, and a group and version (group and version will be inherited from the Gradle project, only if they have been specified.)

build.gradle.kts
import dev.hygradle.dsl.plugin.LatePlugin
hygradle {
plugins {
register<LatePlugin>("examplePlugin") {
manifest {
mainClass = "whatever.my.fully.qualified.plugin.class.is"
group = "MyPlugin"
version = "0.1"
}
}
}
}

There will eventually come a time where you will need to pull in dependencies. Either other Hytale plugins that you want to extend, or plain JVM libraries that you’d like to leverage. Hygradle supports both - the dependencies DSL block when configuring a plugin can be used to specify runtime and compilation dependencies, which will be wired through to server runs.

In general, typical single-plugin projects should specify non-Hytale dependencies through the usual top-level Gradle dependency handlers. However, Hygradle includes a plugin-scoped dependency handler to express dependency semantics that aren’t native to Gradle. If you need to depend on a Hytale plugin, prefer this approach:

build.gradle.kts
import dev.hygradle.dsl.plugin.LatePlugin
hygradle {
plugins {
register<LatePlugin>("examplePlugin") {
dependencies {
plugin("other:mavenartifact:version")
}
}
}
}

You will also need to add the dependency to the manifest:

build.gradle.kts
import dev.hygradle.dsl.plugin.LatePlugin
hygradle {
plugins {
register<LatePlugin>("examplePlugin") {
manifest {
mainClass = "whatever.my.fully.qualified.plugin.class.is"
group = "MyPlugin"
version = "0.1"
dependency {
name = "Dependency"
group = "OtherAuthor"
version = "whateverversionrange"
}
}
}
}
}