|
| 1 | +# mc-kotlin-plugin-template |
| 2 | +Opinionated template/starter for creating Minecraft plugins in Kotlin using the Spigot API |
| 3 | + |
| 4 | +## Features |
| 5 | + |
| 6 | +- Gradle axion-release-plugin for managing semver |
| 7 | + - automatic updating of `CHANGELOG.md` and `main/resources/plugin.yml` when a release is made |
| 8 | +- Github Actions to build PRs and automatically create Github releases when a release tag is pushed |
| 9 | + - Manual Create Version pipeline to increment semver tag and trigger publishing a new version |
| 10 | + - Requires a configured deploy key with write permission to the repository (see usage below) |
| 11 | +- [`ktlint`](https://github.com/JLLeitschuh/ktlint-gradle) Gradle plugin |
| 12 | +- Gradle build generates a standard plugin jar which will download dependencies declared as |
| 13 | +[`libraries`](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/plugin/PluginDescriptionFile.html#getLibraries()) in |
| 14 | +`plugin.yml` and an "offline"/shadowed jar containing necessary dependencies |
| 15 | + |
| 16 | +## Usage |
| 17 | + |
| 18 | +1. Use the template to create a new repository: [Create a new repository](https://github.com/SimpleMC/mc-kotlin-plugin-template/generate) |
| 19 | +2. Change template repository references |
| 20 | + - `settings.gradle.kts` -> set `rootProject.name` |
| 21 | + - `gradle.properties` -> set `repoRef` |
| 22 | + - `build.gradle.kts` -> set `group` |
| 23 | + - `CHANGELOG.md` -> update links to `SimpleMC/mc-kotlin-plugin-template` to match `repoRef` |
| 24 | + - `src/main/resources/plugin.yml` -> set `name`, `main`, `website`, `author` |
| 25 | + - `src/main/kotlin/org/simplemc/plugintemplate/KotlinPluginTemplate.kt` -> Move packages/rename for your plugin |
| 26 | + - `README.md` -> Update |
| 27 | +3. To use the Create Version automation, add an SSH key |
| 28 | + 1. Create an SSH key-pair (no password): `ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/<name_your_key>deploy` |
| 29 | + 2. Add the Public Key as a Deploy Key (**Important! Enable `Allow write access`**): https://docs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keys#set-up-deploy-keys an Actions secret to your new repository: `https://github.com/<repo slug>/settings/secrets/actions/new` |
| 30 | + 3. Add the Private Key as an Actions secret: `https://github.com/<repo slug>/settings/secrets/actions/new` |
| 31 | + - Name: `COMMIT_KEY` |
| 32 | + - Secret Contents: Paste the Private key |
| 33 | + 4. The GitHub Actions are configured to use this key to publish tags and release commits (see `.github/workflows/create-version.yml`) |
| 34 | + - See [axion-release-plugin Authorization](https://axion-release-plugin.readthedocs.io/en/latest/configuration/authorization/) for alternative Auth options |
| 35 | + |
| 36 | +## Examples |
| 37 | + |
| 38 | +Several SimpleMC plugins are built off of this template or were the impetus for it: |
| 39 | + |
| 40 | +- [SimpleNPCs](https://github.com/SimpleMC/SimpleNPCs) - Simple command-based NPC interactions |
| 41 | +- [SimpleHealthbars2](https://github.com/SimpleMC/SimpleHealthbars2) - Simple, easy-to-use healthbar plugin with optional player and mob healthbars |
| 42 | +- [SimpleAnnounce](https://github.com/SimpleMC/SimpleAnnounce) - SimpleAnnounce is a simple and easy to use, yet powerful automated announcement plugin for the Bukkit Minecraft API. |
0 commit comments