Skip to content

Commit

Permalink
feat: 1.21 support (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybw0014 authored Sep 15, 2024
1 parent 24cf7be commit 5807e7b
Show file tree
Hide file tree
Showing 29 changed files with 674 additions and 288 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/blob-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,28 @@ jobs:
if: startsWith(github.event.head_commit.message, '[CI skip]') == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: temurin
- name: Build with Maven
run: mvn package --file pom.xml

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build with Gradle
run: ./gradlew clean shadowJar

- name: Rename jar file
run: mv build/libs/MobCapturer-*.jar build/libs/MobCapturer.jar

- name: Upload to Blob Builds
uses: WalshyDev/blob-builds/gh-action@main
with:
project: MobCapturer
file: ./build/libs/MobCapturer.jar
apiToken: ${{ secrets.BLOB_BUILDS_API_TOKEN }}
releaseNotes: ${{ github.event.head_commit.message }}
16 changes: 11 additions & 5 deletions .github/workflows/maven.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@ jobs:
if: startsWith(github.event.head_commit.message, '[CI skip]') == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: temurin
- name: Build with Maven
run: mvn package --file pom.xml

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build with Gradle
run: ./gradlew clean shadowJar
28 changes: 22 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
/bin/
/.settings/
/target/
/.idea/
*.iml
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
dependency-reduced-pom.xml

.idea/
vscode/
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ The captured mobs will retain attributes, potion effects, fire ticks, custom nam
## :floppy_disk: Download MobCapturer
You can download MobCapturer right here: [Dev Builds](https://blob.build/project/MobCapturer)

### Requirements

- Java 21+
- Minecraft 1.18+

## :gear: config
You can change the following settings in `config.yml`:
Expand Down
66 changes: 66 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
plugins {
id("java")
id("maven-publish")
id("io.freefair.lombok") version "8.7.1"
id("com.gradleup.shadow") version "8.3.0"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
}

repositories {
mavenLocal()
mavenCentral()
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://jitpack.io")
}

dependencies {
compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
compileOnly("com.github.Slimefun:Slimefun4:RC-37")
implementation("org.bstats:bstats-bukkit:3.0.3")
implementation("com.google.code.findbugs:jsr305:3.0.2")
implementation("net.guizhanss:guizhanlib-all:2.0.0-SNAPSHOT")
}

group = "io.github.thebusybiscuit"
version = "UNOFFICIAL"
description = "MobCapturer"

java {
sourceCompatibility = JavaVersion.VERSION_21
}

publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
}
}

tasks.compileJava {
options.encoding = "UTF-8"
}

tasks.javadoc {
options.encoding = "UTF-8"
}

tasks.shadowJar {
fun doRelocate(from: String) {
val last = from.split(".").last()
relocate(from, "io.github.thebusybiscuit.mobcapturer.libs.$last")
}
doRelocate("org.bstats")
doRelocate("javax.annotation")
doRelocate("io.papermc.paperlib")
minimize()
archiveClassifier = ""
}

bukkit {
main = "io.github.thebusybiscuit.mobcapturer.MobCapturer"
apiVersion = "1.18"
authors = listOf("TheBusyBiscuit", "ybw0014")
description = "A Slimefun Addon that adds a tool that allows you to capture mobs"
website = "https://github.com/Slimefun-Addon-Community/MobCapturer"
depend = listOf("Slimefun")
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 5807e7b

Please sign in to comment.