-
-
Notifications
You must be signed in to change notification settings - Fork 18
chore: simplify build configuration and update documentation #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bc305c7
chore(gradle): reference group variable (reduce needed editing)
goopbox 7996898
chore(gradle): remove configurations.creating deprecation
goopbox 6ed7d2d
chore(gradle): simplify java version
goopbox 8da2c64
chore(gradle): fix earlier mockitoAgent revision
goopbox 60304d4
chore(gradle): simplify some comments
goopbox 67c3415
chore(gradle): simplify group access
goopbox 28a66a8
chore(gradle): simplify shadowJar access
goopbox 78009b8
chore(gradle): simplify build task access
goopbox 47a699a
chore(CI): fix inaccurate check
goopbox b27082b
chore(docs): simplify CONTRIBUTING.md reference
goopbox 7576ce4
docs: revise fill-template-plugin skill and outdated info
goopbox 5ed1466
docs: remove outdated info from run-plugin skill
goopbox 829ccc3
docs: revise AGENTS.md
goopbox b9b04ed
docs: revise docs
goopbox 7498675
Update docs/customization.md
91e5d5b
chore(skills): revert run-plugin example class
goopbox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,31 @@ | ||
| This is a **PaperMC/Spigot Minecraft plugin template**. The intent is that users fork/copy it and replace the example scaffolding with their own plugin. | ||
| This repository is a **PaperMC/Spigot Minecraft plugin template**. Users fork or copy it, then replace the example scaffolding with their own plugin. | ||
|
|
||
| ## Architecture | ||
|
|
||
| **Entry point**: `ExamplePlugin extends JavaPlugin` — Bukkit/Paper calls `onEnable()` and `onDisable()` on the plugin lifecycle. The main class is referenced in `plugin.yml` via the `${PACKAGE}.${NAME}` substitution, which is filled at build time by `processResources` from `group` (build.gradle.kts) and `rootProject.name` (settings.gradle.kts). | ||
| **Entry point**: `ExamplePlugin extends JavaPlugin`. Bukkit/Paper calls `onEnable()` and `onDisable()` during the plugin lifecycle. In `plugin.yml`, `${PACKAGE}.${NAME}` identifies the main class. The `processResources` task fills these placeholders at build time from `group` in `build.gradle.kts` and `rootProject.name` in `settings.gradle.kts`. | ||
|
|
||
| **JAR packaging**: The standard `jar` task is disabled. `shadowJar` is the sole output — it shades CommandAPI (relocated to `<group>.commandapi`). CommandAPI is excluded from `minimize()` because it loads classes via reflection. `assemble` depends on `shadowJar`. | ||
| **JAR packaging**: The standard `jar` task is disabled, and `shadowJar` is the sole output. It shades CommandAPI and relocates it to `<group>.commandapi`. CommandAPI is excluded from `minimize()` because it loads classes through reflection. `assemble` depends on `shadowJar`. | ||
|
|
||
| **cw-commons dependency**: `Command`/`BaseCommand` (command registration) and `Config`/`ConfigManager` (YAML config loading + Jakarta validation) come from [cw-commons](https://github.com/CrimsonWarpedcraft/cw-commons), not local code — consumed via JitPack (`com.github.CrimsonWarpedcraft:cw-commons`). `build.gradle.kts` pins a tagged release (e.g. `v0.1.0`) rather than the unstable `main-SNAPSHOT`; bump that tag deliberately. Jackson and Hibernate Validator remain direct dependencies here because `PluginConfig` uses their annotations (`@JsonProperty`, `@NotBlank`) directly — cw-commons exposes them as `api` (transitive, unbundled) dependencies specifically so each consumer shades/relocates its own copy without classloader conflicts. Note that cw-commons' `api` deps already put Jackson/Hibernate Validator on this project's classpath transitively, so the explicit declarations here are redundant for resolution — kept anyway since `PluginConfig` references them directly and shouldn't rely on another project's transitive exposure choices. | ||
| **cw-commons dependency**: [cw-commons](https://github.com/CrimsonWarpedcraft/cw-commons) provides `Command`/`BaseCommand` for command registration and `Config`/`ConfigManager` for YAML loading and Jakarta validation. These classes are not defined locally. The project consumes cw-commons from JitPack as `com.github.CrimsonWarpedcraft:cw-commons`. `build.gradle.kts` pins a tagged release, such as `v0.1.0`, instead of the unstable `main-SNAPSHOT`. Update that tag deliberately. | ||
|
|
||
| Jackson and Hibernate Validator remain direct dependencies because `PluginConfig` uses their `@JsonProperty` and `@NotBlank` annotations. cw-commons exposes these libraries as transitive, unbundled `api` dependencies so each consumer can shade and relocate its own copy without classloader conflicts. The direct declarations are redundant for dependency resolution, but they prevent this project from relying on another project's transitive exposure choices. | ||
|
|
||
| **Command declaration**: CommandAPI registers commands programmatically in `onEnable()` (see `ExampleCommand`/`BaseCommand`). Adding a matching entry under `commands:` in `plugin.yml` makes Bukkit register the same command a second time, which CommandAPI flags at startup with a "Plugin command ... is registered by Bukkit" warning. `permissions:` entries are unaffected and still required. | ||
|
|
||
| **Versioning logic** (in `build.gradle.kts`): | ||
| - No `-Pver` supplied → `yyMMdd-HHmm-SNAPSHOT` | ||
| - `-Pver=vX.Y.Z-RC-N` → `X.Y.Z-SNAPSHOT` | ||
| - `-Pver=vX.Y.Z` → `X.Y.Z` (stable release) | ||
|
|
||
| - No `-Pver` supplied -> `yyMMdd-HHmm-SNAPSHOT` | ||
| - `-Pver=vX.Y.Z-RC-N` -> `X.Y.Z-RC-N-SNAPSHOT` | ||
| - `-Pver=vX.Y.Z` -> `X.Y.Z` (stable release) | ||
|
|
||
| **CI workflows** (`.github/workflows/`): | ||
| - `pr.yml` — builds and tests on Ubuntu + Windows for PRs and merge queue | ||
| - `main.yml` — builds, tests, and cuts a snapshot release on push to `main` | ||
| - `tag.yml` / `release.yml` — handle tagged releases and Discord notifications | ||
|
|
||
| **Agent instructions**: (1) Canonical skills live in `.agents/skills/`; `.claude/skills/` is a generated mirror. (2) `CLAUDE.md` is a generated copy of this `AGENTS.md`. (3) No agents are permitted to edit or create `CLAUDE.md` or `.claude/skills/`; Claude hooks established in `.claude/settings.json` automatically sync these mirrors on `SessionStart` and `PostToolUse`. | ||
| - `pr.yml`: builds and tests on Ubuntu + Windows for PRs and merge queue | ||
| - `main.yml`: builds, tests, and uploads a snapshot artifact on push to `main` | ||
| - `tag.yml` / `release.yml`: handle tagged releases and Discord notifications | ||
|
|
||
| ## Agent instructions | ||
|
|
||
| 1. Canonical skills live in `.agents/skills/`. The `.claude/skills/` directory is a generated mirror. | ||
| 2. `CLAUDE.md` is a generated copy of this `AGENTS.md`. | ||
| 3. Do not edit or create `CLAUDE.md` or files under `.claude/skills/`. Claude hooks configured in `.claude/settings.json` synchronize these mirrors on `SessionStart` and `PostToolUse`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,89 +1,65 @@ | ||
| # Customizing This Template | ||
|
|
||
| When adapting this template for your own plugin, you'll need to update the following files. | ||
| Use this checklist when turning the template into a plugin. | ||
|
|
||
| ### Discord Notifications | ||
| This repo allows automatically pushing releases to a Discord webhook. | ||
| ## Plugin identity | ||
|
|
||
| To use this Action, you will need to set two GitHub Actions secrets. | ||
| - `DISCORD_WEBHOOK_ID` | ||
| - `DISCORD_WEBHOOK_TOKEN` | ||
| 1. Set `rootProject.name` in `settings.gradle.kts` to the Java entry point class name. | ||
| 2. Rename `ExamplePlugin.java`, the `ExamplePlugin` class, and all references to it. The current | ||
| `plugin.yml` build substitution requires this name to match `rootProject.name`. | ||
| 3. Set `group` in `build.gradle.kts` to the Java package. | ||
| 4. Rename the main and test package directories, declarations, and imports from | ||
| `com.crimsonwarpedcraft.exampleplugin`. | ||
|
|
||
| You can find these values by copying the Discord Webhook URL: | ||
| `https://discord.com/api/webhooks/<DISCORD_WEBHOOK_ID>/<DISCORD_WEBHOOK_TOKEN>` | ||
| ## Example code | ||
|
|
||
| Optionally, you can also configure `DISCORD_RELEASE_WEBHOOK_ID` and `DISCORD_RELEASE_WEBHOOK_TOKEN` | ||
| to send release announcements to a separate channel. | ||
| Replace or remove the example command, permission, config, data store, listener, and tests. Keep | ||
| these parts in sync: | ||
|
|
||
| For more information, see [Discord Message Notify](https://github.com/marketplace/actions/discord-message-notify). | ||
| - Command names and permission checks in Java | ||
| - Permission declarations in `src/main/resources/plugin.yml` | ||
| - Fields in `PluginConfig` and `src/main/resources/config.yml` | ||
| - Main and test code | ||
|
|
||
| ### `README.md` | ||
| Make this relevant to your project. | ||
| CommandAPI registers commands in Java. Do not add matching entries under `commands:` in | ||
| `plugin.yml`. | ||
|
|
||
| Be sure to replace the badges for build status and Discord. | ||
| ## Metadata and build | ||
|
|
||
| ### `settings.gradle.kts` | ||
| Replace `ExamplePlugin` with the name of your plugin. | ||
| - Update `author`, `description`, `permissions`, and `api-version` in `plugin.yml`. | ||
| - Keep the Paper API version, Java toolchain, CI Java versions, and documented server support in | ||
| sync. | ||
| - Review repositories, dependencies, Shadow relocations, and `minimize` exclusions. Remove | ||
| example dependencies the plugin no longer uses. | ||
|
|
||
| ```kotlin | ||
| rootProject.name = "ExamplePlugin" | ||
| ``` | ||
| ## Project files | ||
|
|
||
| ### `build.gradle.kts` | ||
| Make sure to update `group` to your package's name in the following section. | ||
| - Rewrite `README.md` for the plugin. Replace the build badge, Discord link, commands, features, | ||
| and repository links. | ||
| - Update `docs/usage.md`, `docs/releases.md`, `AGENTS.md`, and canonical skills under | ||
| `.agents/skills/` when their examples or architecture change. | ||
| - Do not edit `CLAUDE.md` or `.claude/skills/`. They are generated mirrors. | ||
| - Check source attribution and license terms before changing copyright notices. | ||
|
|
||
| ```kotlin | ||
| group = "com.crimsonwarpedcraft.exampleplugin" | ||
| ``` | ||
| ## GitHub | ||
|
|
||
| Add any required repositories for your dependencies: | ||
| - Update `.github/CODEOWNERS` and update or delete `.github/FUNDING.yml`. | ||
| - Replace the enforcement contact in `CODE_OF_CONDUCT.md`. | ||
| - Review issue templates, labels, the stale policy, Dependabot, branch protection, and workflows. | ||
| Update each `main` reference if the repository uses a different default branch. | ||
|
This conversation was marked as resolved.
Outdated
|
||
|
|
||
| ```kotlin | ||
| repositories { | ||
| // ... | ||
| } | ||
| ``` | ||
| Discord notifications use: | ||
|
|
||
| Also, update your dependencies as needed (of course). | ||
| - Repository variable `DISCORD_WEBHOOK_ID` | ||
| - Actions secret `DISCORD_WEBHOOK_TOKEN` | ||
| - Optional repository variable `DISCORD_RELEASE_WEBHOOK_ID` | ||
| - Optional Actions secret `DISCORD_RELEASE_WEBHOOK_TOKEN` | ||
|
|
||
| ```kotlin | ||
| dependencies { | ||
| // ... | ||
| } | ||
| ``` | ||
| Remove the notification jobs if the plugin will not use Discord webhooks. | ||
|
|
||
| ### `src/main/resources/plugin.yml` | ||
| First, update the following with your information. | ||
| ## Verify | ||
|
|
||
| ```yaml | ||
| author: AUTHOR | ||
| description: DESCRIPTION | ||
| ``` | ||
|
|
||
| Next, the `permissions` section below should be updated as needed. | ||
|
|
||
| ```yaml | ||
| permissions: | ||
| example.test: | ||
| description: DESCRIPTION | ||
| default: true | ||
| example.*: | ||
| description: Grants all other permissions | ||
| default: false | ||
| children: | ||
| example.test: true | ||
| ``` | ||
|
|
||
| Do NOT create a `commands:` section — CommandAPI registers commands programmatically in | ||
| `onEnable()` (see `ExampleCommand`), not via `plugin.yml`. | ||
|
|
||
| Declaring a command in both places | ||
| causes Bukkit to register it a second time, which CommandAPI will warn about at startup. | ||
|
|
||
| ### `.github/` | ||
| - `CODEOWNERS` -> Replace `leviem1` with your username. | ||
| - `FUNDING.yml` -> Update or delete this file, [whatever applies to you.](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository) | ||
|
|
||
| ### Code of Conduct | ||
| If you choose to adopt the Code of Conduct for your project, | ||
| please update line 63 of `CODE_OF_CONDUCT.md` with your preferred contact method. | ||
| 1. Search for old names, packages, permissions, placeholders, attribution, and repository URLs. | ||
| 2. Run `./gradlew clean build`. | ||
| 3. Check the processed `plugin.yml` and shaded JAR for the correct main class. | ||
| 4. Start the JAR on the oldest supported Paper version. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.