A simple example plugin for Sponge, demonstrating SpongeGradle.
- Create a new repository from this template
- Change the project name in
settings.gradle.kts - Move the example plugin to a package in your own namespace
- Update project group, version, and plugin information in
build.gradle.kts
To build a plugin, simply run ./gradlew build. While working on your plugin,
run ./gradlew runServer to get a development server with your plugin installed!
sponge { gameTests() } in build.gradle.kts runs Minecraft gametests against your plugin on a headless
SpongeVanilla server: ./gradlew test, or the run icon beside a test in your IDE. Tests live in src/test and
never ship in your plugin's jar; see ExampleGameTests for the shape of one.
- A test class is annotated
@GameTestGroup, and each test is an instance method annotated@GameTestthat takes only aGameTestHelper. Tests are named<plugin id>.<group>.<method_name>. - A test ends when it calls
succeed()or itssucceedWhen(...)check holds; otherwise it fails oncemaxTicksrun out. GameTestHelperpositions are relative to the test's own space; convert them withabsolutePosbefore passing them to the Sponge API.- Tests in a group run at the same time on one server, so keep shared state, like static fields, out of them.
Read more about Sponge plugin development at (docs not yet written)
Read more about Gradle from Gradle's documentation and tutorials
Feel free to come to the Sponge discord for help too!
Is there anything incorrect or confusing about this plugin template? Feel free to submit a PR with any corrections.
This plugin template is released under the terms of the Creative Commons CC0 license -- it is available without restriction.