---
url: https://docs.sunlicense.com/guide/paper-plugin.md
---
# Paper plugin template

A complete Minecraft (Paper) plugin with SunLicense built in, to copy and build on:
**[github.com/sunlicense-com/example-paper-plugin](https://github.com/sunlicense-com/example-paper-plugin)**
(MIT No Attribution: copy any of it without credit).

* Gradle + Shadow, with the [Java SDK](/guide/sdks) relocated into your own package
* The license key from `config.yml`, or built in by [BuiltByBit](/integrations/builtbybit) and [Voxel Shop](/integrations/voxel-shop) placeholders
* A clear console message for every [result code](/guide/concepts#validation-result-codes), keys masked
* A re-check every few hours, so [revoking](/guide/concepts#license) a leaked key reaches running servers
* An [offline license](/guide/offline-licenses) fallback, and the plugin keeps running if SunLicense can't be reached (your choice)
* A sealed core in release builds: only a valid license runs your features, and modified copies are reported
* Tests against a stub server, a GitHub Actions workflow and an `AGENTS.md` that tells AI assistants how to work in it without weakening the check

## Get started

1. In the dashboard, create a product and a policy (machines = servers), and an **API key**.
2. Use the template on GitHub (**Use this template**), rename `com.example.myplugin`, and put the key in
   `~/.gradle/gradle.properties` as `sunlicenseApiKey=slk_...` (never in git).
3. `./gradlew build`, or `./gradlew runServer` for a local Paper server with the plugin.
4. Put your features in `core/CoreFeatures.java`: they start once the license is valid.
5. For the jar you sell: `./gradlew build -PsunlicenseProduct=<your product code>` (with the [CLI](/cli/) signed in)
   writes `build/release/…jar`, where the core is sealed so only a valid license runs it, the other classes are
   checked for tampering, and an ownership notice is logged at start-up
   ([protection](/guide/sdks#protection-core-unlock-tamper-reports-notice-protected-files)).

The template's README covers the details: selling on each store, the offline file, what server owners see.

::: tip Testing with your own license
Each test server takes one of the license's machine slots. Use a test license with a higher machine limit, or free slots from the license page.
:::
