diff --git a/.github/workflows/GradleBuild.yml b/.github/workflows/GradleBuild.yml index 2e5c086..63bafc7 100644 --- a/.github/workflows/GradleBuild.yml +++ b/.github/workflows/GradleBuild.yml @@ -11,13 +11,13 @@ jobs: testShips: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - name: Set up JDK 17 - uses: actions/setup-java@v3 + - name: Set up JDK 21 + uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'adopt' - name: Run all tests run: ./gradlew test @@ -34,7 +34,7 @@ jobs: needs: [ testShips ] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Set up JDK 11 @@ -54,10 +54,10 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'adopt' - name: Build Folia with Gradle run: ./gradlew buildPaper @@ -69,13 +69,13 @@ jobs: needs: [ buildTranslateFolia, testShips ] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - name: Setup JDK 17 - uses: actions/setup-java@v3 + - name: Setup JDK 21 + uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'adopt' - name: Build Folia with Gradle run: ./gradlew buildPaper @@ -83,18 +83,18 @@ jobs: with: name: "Standalone-Ships-Folia-And-Paper" path: "standalone/ShipsFolia.jar" - build1-20-4Folia: + build1-20-6Folia: needs: [ buildTranslateFolia ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: submodules: true - - name: Setup JDK 17 - uses: actions/setup-java@v3 + - name: Setup JDK 21 + uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'adopt' - name: Build Folia with Gradle - run: ./gradlew buildPaper -Pfolia-api-version=1.20.4 -Puse-paper=true + run: ./gradlew buildPaper -Pfolia-api-version=1.20.6 -Puse-paper=true diff --git a/.github/workflows/Test compile against.yml b/.github/workflows/Test compile against.yml index d047e5d..1563dd0 100644 --- a/.github/workflows/Test compile against.yml +++ b/.github/workflows/Test compile against.yml @@ -1,4 +1,3 @@ - # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by # separate terms of service, privacy policy, and support @@ -11,7 +10,7 @@ name: Build Bukkit with specific on: workflow_dispatch: inputs: - version: + version: type: string description: MC version @@ -25,13 +24,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: - submodules: true - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - name: Build with Gradle - run: ./gradlew CoreToBukkit:plugin -P paper-api-version=${{ github.event.inputs.version }} + - uses: actions/checkout@v3 + with: + submodules: true + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + - name: Build with Gradle + run: ./gradlew CoreToBukkit:plugin -P paper-api-version=${{ github.event.inputs.version }} diff --git a/build.gradle b/build.gradle index a2a12ae..4f5d716 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import java.util.regex.Pattern + plugins { id 'java-library' } @@ -8,7 +10,8 @@ description 'Full' apply from: 'buildGradle/build.gradle' -java.sourceCompatibility = JavaVersion.VERSION_17 +var targetJavaVersion = isGreater(20, 5) ? 21 : 17 +java.sourceCompatibility = JavaLanguageVersion.of(targetJavaVersion) compileJava.options.encoding = 'UTF-8' tasks.withType(JavaCompile) { options.encoding = 'UTF-8' @@ -16,4 +19,14 @@ tasks.withType(JavaCompile) { dependencies { api files(project.projectDir.path + '/ShipsForCore/build/libs/ShipsForCore-' + project.version + "-Beta.jar") +} + +boolean isGreater(int major, int minor) { + var targetMinecraftVersion = project.hasProperty("folia-api-version") ? (String) project.property("folia-api-version") : "1.20.1" + var targetMajorVersion = Integer.parseInt(targetMinecraftVersion.split(Pattern.quote('.'))[1]) + var targetMinorVersion = Integer.parseInt(targetMinecraftVersion.split(Pattern.quote('.'))[2]) + if (targetMajorVersion < major) { + return true; + } + return targetMajorVersion == major && targetMinorVersion <= minor; } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c..0000000 Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 00e33ed..0d18421 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists