Skip to content
Open
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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gradlew text eol=lf
*.bat text eol=crlf
*.jar binary
10 changes: 6 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: "maven"
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
Expand All @@ -9,15 +9,16 @@ updates:
open-pull-requests-limit: 10
labels: [ "dependencies" ]
groups:
maven-plugins:
gradle-plugins:
patterns:
- "org.apache.maven.plugins:*"
- "xyz.jpenilla.run-paper*"
- "org.gradle.toolchains.foojay-resolver*"
papermc:
patterns:
- "io.papermc.paper:*"
lombok:
patterns:
- "org.projectlombok:*"
- "io.freefair.lombok*"

- package-ecosystem: "github-actions"
directory: "/"
Expand All @@ -32,5 +33,6 @@ updates:
patterns:
- "actions/*"
- "google-github-actions/*"
- "gradle/actions"
- "softprops/action-gh-release"

11 changes: 4 additions & 7 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"packages": {
".": {
"release-type": "maven",
"package-name": "com.stdnullptr:Pokeball",
"release-type": "simple",
"package-name": "Pokeball",
"component": "pokeball",
"skip-snapshot": true,
"include-component-in-tag": false,
"extra-files": [
{
"type": "yaml",
"path": "src/main/resources/paper-plugin.yml",
"jsonpath": "$.version"
"type": "generic",
"path": "gradle.properties"
}
]
}
}
}

10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ jobs:
with:
distribution: temurin
java-version: '21'
cache: maven

- name: Build with Maven
run: mvn -B -ntp package
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6

- name: Build with Gradle
run: ./gradlew build

- name: Compute artifact name
id: meta
shell: bash
run: |
JAR=$(ls -1 target/Pokeball-*.jar | head -n 1)
JAR=$(ls -1 build/libs/Pokeball-*.jar | head -n 1)
NAME=$(basename "$JAR")
NAME_NO_EXT="${NAME%.jar}"
echo "jar=$JAR" >> "$GITHUB_OUTPUT"
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,21 @@ jobs:
with:
distribution: temurin
java-version: '21'
cache: maven

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
with:
cache-read-only: true

- name: Build JAR
run: mvn -B -ntp clean package
run: ./gradlew clean build

- name: Attach JAR to Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.release.tag_name }}
files: |
target/Pokeball-*.jar
build/libs/Pokeball-*.jar
fail_on_unmatched_files: true
overwrite_files: true
token: ${{ secrets.ADMIN_TOKEN }}
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
*.iml
.idea
target/
build/
.gradle/
.kotlin/
run/
tmp_*.html
11 changes: 7 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Scope: This file applies to the entire repository.

- Type: Paper plugin
- Language/Runtime: Java 21 (LTS)
- Build: Maven (shade configured; runtime libs provided via Paper `libraries:`)
- Build: Gradle (Kotlin DSL, wrapper, toolchains), `run-paper` for local test servers
- Entry: `com.stdnullptr.pokeball.Pokeball`
- Plugin meta: `src/main/resources/paper-plugin.yml` (Paper metadata only)
- API target: Paper 1.21.x (`api-version: 1.21`)
- API target: paper-api 1.21.11 (`api-version: 1.21`); runs on Paper 1.21.x and 26.x

## Goals and Philosophy

Expand All @@ -25,8 +25,11 @@ Scope: This file applies to the entire repository.

## Build & Run

- Build: `mvn -q -DskipTests package`
- Output: `target/Pokeball-<version>.jar`
- Build: `./gradlew build`
- Output: `build/libs/Pokeball-<version>.jar`
- Run: `./gradlew runServer` (Paper 26.3) or `./gradlew runServerOldest` (Paper 1.21.11); server files in `run/`.
- Version: `gradle.properties` is the single source; `paper-plugin.yml` gets it at build time and
release-please bumps it.
- Deploy: drop the jar into your server's `plugins/` folder.

## Repository Conventions (IMPORTANT)
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Pokeball lets you catch a mob in a ball and throw it back out, just like in Pok
straightforward, reliable, and easy to configure - great for survival or adventure servers where players need to move
mobs without leads or boats.

Built against Paper API 1.21.8 (Minecraft 1.21.x)
Built against Paper API 1.21.11; runs on Paper 1.21.x and 26.x (tested on 1.21.11 and 26.3)

## Get It

Expand Down Expand Up @@ -39,7 +39,7 @@ https://github.com/user-attachments/assets/ff69137f-0903-4fe2-8e1a-fa4adb28f12a

## Requirements

- Paper 1.21.x
- Paper 1.21.x or 26.x (tested on 1.21.11 and 26.3)
- Java 21 (LTS)
- Folia: not currently supported (`folia-supported: false` in `paper-plugin.yml`:9)

Expand Down Expand Up @@ -114,7 +114,7 @@ https://github.com/user-attachments/assets/ff69137f-0903-4fe2-8e1a-fa4adb28f12a

## Compatibility

- Paper 1.21.x (api-version `1.21`).
- Paper 1.21.x and 26.x (api-version `1.21`).
- Folia: not currently supported (`folia-supported: false`).
- No NMS; uses modern Paper APIs and Adventure Components.

Expand Down Expand Up @@ -226,8 +226,15 @@ https://github.com/user-attachments/assets/ff69137f-0903-4fe2-8e1a-fa4adb28f12a

## Build From Source

- Build: `mvn -q -DskipTests package`
- Output: `target/Pokeball-<version>.jar`
No local JDK or Gradle install needed: the wrapper downloads Gradle, and Gradle downloads the JDKs it needs.

- Build: `./gradlew build` (Windows: `gradlew.bat build`)
- Output: `build/libs/Pokeball-<version>.jar`
- Test server: `./gradlew runServer` starts Paper 26.3 in `run/26.3` with the plugin installed;
`./gradlew runServerOldest` does the same on Paper 1.21.11. Accept the EULA in that folder's
`eula.txt` on first run, then join `localhost`.
- Hotswap: run either task in IntelliJ's debugger, edit code, then Run > Debugging Actions > Reload
Changed Classes. The servers run on the JetBrains Runtime, so new methods and fields hotswap too.

## License

Expand Down
65 changes: 65 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import xyz.jpenilla.runpaper.task.RunServer

plugins {
java
id("io.freefair.lombok") version "9.8.3"
id("xyz.jpenilla.run-paper") version "3.1.0"
}

// Compiling against 1.21.11 with Java 21 bytecode keeps one jar loadable on 1.21.11 and every 26.x server.
val apiVersion = "1.21.11"
val targetJava = 21

repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
}

dependencies {
compileOnly("io.papermc.paper:paper-api:$apiVersion-R0.1-SNAPSHOT")
}

java {
toolchain.languageVersion = JavaLanguageVersion.of(targetJava)
}

tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release = targetJava
}

processResources {
val props = mapOf("version" to project.version)
inputs.properties(props)
filesMatching("paper-plugin.yml") {
expand(props)
}
}

// Latest server. Minecraft 26.x needs Java 25. The JetBrains Runtime allows hotswapping
// structural changes (new methods/fields) from an IntelliJ debug session.
runServer {
minecraftVersion("26.3")
runDirectory = layout.projectDirectory.dir("run/26.3")
javaLauncher = project.javaToolchains.launcherFor {
vendor = JvmVendorSpec.JETBRAINS
languageVersion = JavaLanguageVersion.of(25)
}
jvmArgs("-XX:+AllowEnhancedClassRedefinition")
}

// Oldest supported server, to catch API drift.
register<RunServer>("runServerOldest") {
group = "run paper"
description = "Runs a Paper $apiVersion server with this plugin."
minecraftVersion(apiVersion)
runDirectory = layout.projectDirectory.dir("run/$apiVersion")
pluginJars.from(jar.flatMap { it.archiveFile })
javaLauncher = project.javaToolchains.launcherFor {
vendor = JvmVendorSpec.JETBRAINS
languageVersion = JavaLanguageVersion.of(targetJava)
}
jvmArgs("-XX:+AllowEnhancedClassRedefinition")
}
}
7 changes: 7 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
group=com.stdnullptr
# x-release-please-start-version
version=1.2.0
# x-release-please-end

org.gradle.caching=true
org.gradle.configuration-cache=true
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
10 changes: 10 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=971fcd7150ca4ba04852c0b2ca0d2d0ab9468e14b03473eab19528809914c76b
distributionUrl=https\://services.gradle.org/distributions/gradle-9.9.2-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading