From 49627d58b56deeff5552b451f7baa4f778e064a4 Mon Sep 17 00:00:00 2001 From: Dylan Garvis Date: Sat, 12 Sep 2026 14:07:13 -0400 Subject: [PATCH] feat(creeper-fear): migrate distribution to Java 25 and Purpur BREAKING CHANGE: New releases require Java 25/Purpur 26.2 and use purpur-creeper-fear-.jar. Runtime CreeperFear identity and existing SQLite progression data are retained, including the bundled driver. Replace the old JAR rather than installing both distributions. --- .gitea/workflows/ci.yml | 4 +- .gitea/workflows/release.yml | 10 ++-- AGENTS.md | 6 +- README.md | 14 +++-- build.gradle.kts | 11 ++-- settings.gradle.kts | 2 +- .../creeperfear/PurpurDistributionTest.java | 56 +++++++++++++++++++ 7 files changed, 82 insertions(+), 21 deletions(-) create mode 100644 src/test/java/games/dmg/creeperfear/PurpurDistributionTest.java diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 90a1762..57a57fc 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: 17 + java-version: 25 cache: gradle - name: Validate conventional commits @@ -35,6 +35,6 @@ jobs: - name: Upload development artifact uses: actions/upload-artifact@v3 with: - name: spigot-creeper-fear-${{ github.sha }} + name: purpur-creeper-fear-${{ github.sha }} path: build/libs/*.jar if-no-files-found: error diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 101f676..ca4d75f 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -21,7 +21,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: 17 + java-version: 25 cache: gradle - name: Set up Node.js @@ -86,8 +86,8 @@ jobs: if: steps.release.outputs.created == 'true' uses: actions/upload-artifact@v3 with: - name: spigot-creeper-fear-${{ steps.release.outputs.version }} - path: build/libs/spigot-creeper-fear-${{ steps.release.outputs.version }}.jar + name: purpur-creeper-fear-${{ steps.release.outputs.version }} + path: build/libs/purpur-creeper-fear-${{ steps.release.outputs.version }}.jar if-no-files-found: error - name: Create Gitea release and upload plugin @@ -101,7 +101,7 @@ jobs: PREVIOUS_TAG: ${{ steps.previous_tag.outputs.value }} run: | api_url="${GITEA_SERVER_URL}/api/v1" - jar="build/libs/spigot-creeper-fear-${VERSION}.jar" + jar="build/libs/purpur-creeper-fear-${VERSION}.jar" export RELEASE_BODY if [ -n "$PREVIOUS_TAG" ]; then RELEASE_BODY=$(git log --pretty='format:- %s (%h)' "${PREVIOUS_TAG}..HEAD") @@ -137,4 +137,4 @@ jobs: -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/octet-stream" \ --data-binary "@${jar}" \ - "${api_url}/repos/${REPOSITORY}/releases/${release_id}/assets?name=spigot-creeper-fear-${VERSION}.jar" + "${api_url}/repos/${REPOSITORY}/releases/${release_id}/assets?name=purpur-creeper-fear-${VERSION}.jar" diff --git a/AGENTS.md b/AGENTS.md index 90fd865..baeb5e3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,9 +1,9 @@ -# spigot-creeper-fear agent entrypoint +# purpur-creeper-fear agent entrypoint The canonical stories, engineering guidance, and **all process documents** are in the private [SoMC OKF wiki](https://git.garvis.dev/dmg/somc-okf/src/branch/main/index.md). -Before work, read the sibling `../somc-okf/index.md`, `../somc-okf/processes/index.md`, `../somc-okf/projects/spigot-creeper-fear/index.md`, `engineering.md` in that project section, and relevant `../somc-okf/user-stories/spigot-creeper-fear/` stories. Also follow the parent workspace `AGENTS.md` when present. +Before work, read the sibling `../somc-okf/index.md`, `../somc-okf/processes/index.md`, `../somc-okf/projects/purpur-creeper-fear/index.md`, `engineering.md` in that project section, and relevant `../somc-okf/user-stories/purpur-creeper-fear/` stories. Also follow the parent workspace `AGENTS.md` when present. -For standalone checkouts, start at the [project page](https://git.garvis.dev/dmg/somc-okf/src/branch/main/projects/spigot-creeper-fear/index.md) and [shared process](https://git.garvis.dev/dmg/somc-okf/src/branch/main/processes/development.md). Obtain wiki access before feature work; do not recreate a local knowledge bundle. Source builds do not require private wiki access. +For standalone checkouts, start at the [project page](https://git.garvis.dev/dmg/somc-okf/src/branch/main/projects/purpur-creeper-fear/index.md) and [shared process](https://git.garvis.dev/dmg/somc-okf/src/branch/main/processes/development.md). Obtain wiki access before feature work; do not recreate a local knowledge bundle. Source builds do not require private wiki access. Development follows [Development cycle](https://git.garvis.dev/dmg/somc-okf/src/branch/main/runbooks/development-cycle.md): approved stories, failing tests, passing implementation, verification, then source/wiki commit and push. GitOps updates are committed locally **without pushing**; only [Do release](https://git.garvis.dev/dmg/somc-okf/src/branch/main/runbooks/do-release.md) authorizes a reviewed GitOps push. diff --git a/README.md b/README.md index 2238b41..6e4abc0 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ -# Spigot Creeper Fear +# Purpur Creeper Fear -A Spigot 26.2 plugin that lets players earn six Creeper Aura ranks. Once unlocked, an aura prevents a creeper explosion within 25 blocks of the player from breaking blocks, whether or not the explosion hits the player. Players hit by the explosion receive rank-dependent damage. +A Purpur 26.2 plugin that lets players earn six Creeper Aura ranks. Once unlocked, an aura prevents a creeper explosion within 25 blocks of the player from breaking blocks, whether or not the explosion hits the player. Players hit by the explosion receive rank-dependent damage. ## Requirements -- Spigot 26.2 -- Java 17 or newer +- Purpur 26.2 build 2618 +- Java 25 + +New repositories/checkouts/artifacts use `purpur-creeper-fear`; runtime `CreeperFear`, Java entrypoint/packages, commands/permissions and `plugins/CreeperFear/player-progress.sqlite3` are unchanged. The SQLite driver remains bundled. Replace the old JAR rather than installing both distributions. Old tags/assets are retained, and the v1.3.0 download was verified byte-for-byte after renaming. New releases no longer support Java 17. ## Progression @@ -29,7 +31,7 @@ After each point, a temporary boss bar shows current-tier progress. Unlocking a ```bash ./gradlew clean check jar -cp build/libs/spigot-creeper-fear-0.1.0-SNAPSHOT.jar /path/to/server/plugins/ +cp build/libs/purpur-creeper-fear-0.1.0-SNAPSHOT.jar /path/to/server/plugins/ ``` Restart the server after copying the JAR. The plugin creates its configuration and SQLite database under `plugins/CreeperFear/`. @@ -99,4 +101,4 @@ For a local versioned artifact: ## Design -The [SoMC OKF wiki](https://git.garvis.dev/dmg/somc-okf/src/branch/main/projects/spigot-creeper-fear/index.md) contains the architecture and completed user stories. +The [SoMC OKF wiki](https://git.garvis.dev/dmg/somc-okf/src/branch/main/projects/purpur-creeper-fear/index.md) contains the architecture and completed user stories. diff --git a/build.gradle.kts b/build.gradle.kts index 8801d8c..3c89d8a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,12 +9,12 @@ version = providers.gradleProperty("releaseVersion") repositories { mavenCentral() - maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") + maven("https://repo.purpurmc.org/snapshots/") } java { toolchain { - languageVersion = JavaLanguageVersion.of(17) + languageVersion = JavaLanguageVersion.of(25) } } @@ -23,10 +23,10 @@ tasks.withType().configureEach { } dependencies { - compileOnly("org.spigotmc:spigot-api:26.2-R0.1-SNAPSHOT") + compileOnly("org.purpurmc.purpur:purpur-api:26.2.build.2618-stable") implementation("org.xerial:sqlite-jdbc:3.50.3.0") - testImplementation("org.spigotmc:spigot-api:26.2-R0.1-SNAPSHOT") + testImplementation("org.purpurmc.purpur:purpur-api:26.2.build.2618-stable") testImplementation(platform("org.junit:junit-bom:5.13.4")) testImplementation("org.junit.jupiter:junit-jupiter") testImplementation("org.mockito:mockito-core:5.18.0") @@ -35,6 +35,9 @@ dependencies { tasks.test { useJUnitPlatform() + dependsOn(tasks.jar) + systemProperty("distribution.jar", tasks.jar.get().archiveFile.get().asFile.absolutePath) + systemProperty("distribution.version", project.version.toString()) } val pluginVersion = version diff --git a/settings.gradle.kts b/settings.gradle.kts index 3ed3132..e86f729 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1 @@ -rootProject.name = "spigot-creeper-fear" +rootProject.name = "purpur-creeper-fear" diff --git a/src/test/java/games/dmg/creeperfear/PurpurDistributionTest.java b/src/test/java/games/dmg/creeperfear/PurpurDistributionTest.java new file mode 100644 index 0000000..3234896 --- /dev/null +++ b/src/test/java/games/dmg/creeperfear/PurpurDistributionTest.java @@ -0,0 +1,56 @@ +package games.dmg.creeperfear; + +import static org.junit.jupiter.api.Assertions.*; + +import java.io.DataInputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Map; +import java.util.jar.JarFile; +import org.junit.jupiter.api.Test; +import org.yaml.snakeyaml.Yaml; + +class PurpurDistributionTest { + @Test + void packagesNewNameWithoutChangingRuntimeIdentityOrBundlingTheApi() throws Exception { + Path artifact = Path.of(System.getProperty("distribution.jar")); + String version = System.getProperty("distribution.version"); + assertEquals("purpur-creeper-fear-" + version + ".jar", artifact.getFileName().toString()); + try (var jar = new JarFile(artifact.toFile())) { + Map metadata = new Yaml().load(jar.getInputStream(jar.getJarEntry("plugin.yml"))); + assertEquals(version, metadata.get("version")); + assertEquals("CreeperFear", metadata.get("name"), "Retain the data directory and persistent namespace"); + assertEquals("games.dmg.creeperfear.CreeperFearPlugin", metadata.get("main")); + assertTrue(((Map) metadata.get("permissions")).containsKey("creeperfear.admin.modify")); + assertNotNull(jar.getJarEntry("org/sqlite/JDBC.class"), "The SQLite driver must remain bundled"); + assertNotNull(jar.getJarEntry("META-INF/services/java.sql.Driver")); + assertEquals("true", jar.getManifest().getMainAttributes().getValue("Multi-Release")); + assertFalse(jar.stream().anyMatch(entry -> entry.getName().startsWith("org/bukkit/") + || entry.getName().startsWith("org/purpurmc/") || entry.getName().endsWith("Test.class"))); + } + } + + @Test + void pluginBytecodeTargetsJava25() throws Exception { + try (var jar = new JarFile(System.getProperty("distribution.jar")); + var bytecode = new DataInputStream(jar.getInputStream( + jar.getJarEntry("games/dmg/creeperfear/CreeperFearPlugin.class")))) { + assertEquals(0xCAFEBABE, bytecode.readInt()); + bytecode.readUnsignedShort(); + assertEquals(69, bytecode.readUnsignedShort()); + } + } + + @Test + void releaseAndCiAgreeWithThePurpurDistributionNameAndToolchain() throws Exception { + String build = Files.readString(Path.of("build.gradle.kts")); + assertTrue(build.contains("purpur-api:26.2.build.2618-stable")); + assertFalse(build.contains("org.spigotmc:spigot-api")); + for (String workflow : new String[] {"ci.yml", "release.yml"}) { + String content = Files.readString(Path.of(".gitea/workflows", workflow)); + assertTrue(content.contains("java-version: 25")); + assertTrue(content.contains("purpur-creeper-fear-"), workflow); + assertFalse(content.contains("spigot-creeper-fear-"), workflow); + } + } +}