Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ Checkstyle enforces Google Java style with `maxWarnings = 0` — the build fails

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.

**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) and `rootProject.name` (settings.gradle).
**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).

**JAR packaging**: The standard `jar` task is disabled. `shadowJar` is the sole output — it shades PaperLib (relocated to `shadow.io.papermc.paperlib`) and CommandAPI (relocated to `<group>.commandapi`). CommandAPI is excluded from `minimize()` because it loads classes via 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` 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.
**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.

**Commands are not declared in `plugin.yml`**: 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`):
**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)
Expand All @@ -56,8 +56,8 @@ Command executor unit tests (`Ping`, `Greet`, etc.) use Mockito directly — moc
## Template Customization Checklist

When adapting this template for a real plugin, update:
1. `settings.gradle` — `rootProject.name`
2. `build.gradle` — `group` (Java package)
1. `settings.gradle.kts` — `rootProject.name`
2. `build.gradle.kts` — `group` (Java package)
3. `src/main/resources/plugin.yml` — `author`, `description`, `commands`, `permissions`
4. Rename the Java package and source directory from `com.crimsonwarpedcraft.exampleplugin`
5. `.github/dependabot.yml`, `.github/CODEOWNERS`, `.github/FUNDING.yml` — replace `leviem1`
Expand Down
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,27 +117,27 @@ For more information, see [Discord Message Notify](https://github.com/marketplac

This file contains a badge for build status and one for Discord. Be sure to replace these.

### settings.gradle
### settings.gradle.kts
Update the line below with the name of your plugin.

```groovy
rootProject.name = 'ExamplePlugin'
```kotlin
rootProject.name = "ExamplePlugin"
```

### build.gradle
### build.gradle.kts
Make sure to update the `group` to your package's name in the following section.

```groovy
```kotlin
group = "com.crimsonwarpedcraft.exampleplugin"
```

Add any required repositories for your dependencies in the following section.

```groovy
```kotlin
repositories {
maven {
name 'papermc'
url 'https://papermc.io/repo/repository/maven-public/'
name = "papermc"
url = uri("https://repo.papermc.io/repository/maven-public/")
content {
includeModule("io.papermc.paper", "paper-api")
includeModule("io.papermc", "paperlib")
Expand All @@ -149,8 +149,8 @@ repositories {

// JitPack — required for cw-commons, remove if you drop that dependency
maven {
name 'jitpack'
url 'https://jitpack.io'
name = "jitpack"
url = uri("https://jitpack.io")
content {
includeGroup("com.github.CrimsonWarpedcraft")
}
Expand All @@ -160,26 +160,26 @@ repositories {

Also, update your dependencies as needed (of course).

```groovy
```kotlin
dependencies {
compileOnly 'io.papermc.paper:paper-api:26.1.2.build.69-stable'
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.8'
compileOnly("io.papermc.paper:paper-api:26.1.2.build.69-stable")
compileOnly("com.github.spotbugs:spotbugs-annotations:4.10.2")
// cw-commons — shared Command/Config infrastructure (BaseCommand, Config, ConfigManager).
implementation 'com.github.CrimsonWarpedcraft:cw-commons:v0.1.0'
implementation 'io.papermc:paperlib:1.0.8'
implementation("com.github.CrimsonWarpedcraft:cw-commons:v0.1.0")
implementation("io.papermc:paperlib:1.0.8")
// CommandAPI — remove if you don't need the example command
implementation 'dev.jorel:commandapi-paper-shade:11.2.0'
implementation("dev.jorel:commandapi-paper-shade:11.2.0")
// Jackson + Hibernate Validator — needed directly because PluginConfig uses their
// annotations (@JsonProperty, @NotBlank); cw-commons exposes them transitively too,
// but each consumer shades/relocates its own copy to avoid classloader conflicts.
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.3'
implementation 'org.hibernate.validator:hibernate-validator:8.0.2.Final'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0'
testCompileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.8'
testImplementation 'io.papermc.paper:paper-api:26.1.2.build.69-stable'
testImplementation 'org.junit.jupiter:junit-jupiter:6.1.0'
testImplementation 'org.mockito:mockito-core:5.20.0'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:6.1.0'
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.22.0")
implementation("org.hibernate.validator:hibernate-validator:9.1.0.Final")
spotbugsPlugins("com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0")
testCompileOnly("com.github.spotbugs:spotbugs-annotations:4.10.2")
testImplementation("io.papermc.paper:paper-api:26.1.2.build.69-stable")
testImplementation("org.junit.jupiter:junit-jupiter:6.1.0")
testImplementation("org.mockito:mockito-core:5.23.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:6.1.0")
}
```

Expand Down
181 changes: 0 additions & 181 deletions build.gradle

This file was deleted.

Loading
Loading