Skip to content

Commit

Permalink
refactor: 1.21 support (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybw0014 authored Sep 17, 2024
1 parent ffbbd7a commit c935974
Show file tree
Hide file tree
Showing 21 changed files with 767 additions and 363 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/ExtraHeads-*.jar build/libs/ExtraHeads.jar

- name: Upload to Blob Builds
uses: WalshyDev/blob-builds/gh-action@main
with:
project: ExtraHeads
file: ./build/libs/ExtraHeads.jar
apiToken: ${{ secrets.BLOB_BUILDS_API_TOKEN }}
releaseNotes: ${{ github.event.head_commit.message }}
18 changes: 13 additions & 5 deletions .github/workflows/maven.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Java CI

on:
push:
branches:
Expand All @@ -11,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
30 changes: 23 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
.classpath
.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
*.iml
/.idea/
/.settings/
/bin/
/target/
dependency-reduced-pom.xml
# JDT-specific (Eclipse Java Development Tools)
.classpath

.idea/
vscode/
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ExtraHeads
ExtraHeads is a [Slimefun4](https://github.com/Slimefun/Slimefun4/) Addon.<br>
ExtraHeads is a [Slimefun4](https://github.com/Slimefun/Slimefun4/) Addon.
You need to install Slimefun4 in order for this plugin to work.

ExtraHeads is a Slimefun4 Addon that simply adds new mob heads to the game.
Expand All @@ -9,6 +9,9 @@ You can increase your chances by using a Sword of Beheading.
## Download ExtraHeads
You can download ExtraHeads right here: [Dev Builds](https://blob.build/project/ExtraHeads)

### Requirements
- Java 21+
- Minecraft 1.18+

## Discord
You can find Slimefun's community on Discord!
Expand Down
58 changes: 58 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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 {
mavenCentral()
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://jitpack.io")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
}

dependencies {
compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
compileOnly("com.github.Slimefun:Slimefun4:e02a0f61d1")
compileOnly("me.clip:placeholderapi:2.11.6")
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"

java {
sourceCompatibility = JavaVersion.VERSION_21
}

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

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

bukkit {
main = "io.github.thebusybiscuit.extraheads.ExtraHeads"
apiVersion = "1.18"
authors = listOf("TheBusyBiscuit", "ybw0014")
description = "A Slimefun Addon that adds heads of mobs"
website = "https://github.com/Slimefun-Addon-Community/ExtraHeads"
depend = listOf("Slimefun")
softDepend = listOf("PlaceholderAPI")
}
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.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit c935974

Please sign in to comment.