From f2ce9c406ec78a6767d9a3e82690e87ad058688c Mon Sep 17 00:00:00 2001 From: Shynixn Date: Fri, 22 Sep 2023 17:09:04 +0200 Subject: [PATCH] #459 Updated version handling. --- .github/workflows/main.yml | 20 +++++++++++++++++-- .../blockball/bukkit/BlockBallPlugin.kt | 14 ++++++++++--- build.gradle | 10 +++++----- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fc0e24c7a..d595a3840 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -68,10 +68,10 @@ jobs: body: "This release was automatically created by Github Actions. Please wait until the author manually sets the patchnotes for this release." tag_name: ${{ env.RELEASE_VERSION }} release_name: Release ${{ env.RELEASE_VERSION }} - draft: false + draft: true prerelease: false - - name: Upload Bukkit Release to Github + - name: Upload Latest Bukkit Release to Github if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'master')" uses: actions/upload-release-asset@v1 env: @@ -82,6 +82,22 @@ jobs: asset_name: BlockBall.jar asset_content_type: application/jar + - name: Build Java Application with all flag + run: | + sed -i "s/###VERSION###/all/g" ./blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/BlockBallPlugin.kt + ./gradlew build pluginJar + + - name: Upload All Bukkit Release to Github + if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'master')" + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: /home/runner/work/BlockBall/BlockBall/blockball-bukkit-plugin/build/libs/blockball-bukkit-plugin-${{ env.RELEASE_VERSION }}.jar + asset_name: BlockBall-All.jar + asset_content_type: application/jar + Documentation: runs-on: ubuntu-latest if: "contains(github.ref, 'master')" diff --git a/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/BlockBallPlugin.kt b/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/BlockBallPlugin.kt index fbd0b4125..267d116ae 100644 --- a/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/BlockBallPlugin.kt +++ b/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/BlockBallPlugin.kt @@ -37,6 +37,7 @@ class BlockBallPlugin : JavaPlugin(), PluginProxy { private var injector: Injector? = null private var serverVersion: Version? = null private val bstatsPluginId = 1317 + private val versionFlag = "###VERSION###" /** * Gets the installed version of the plugin. @@ -69,7 +70,8 @@ class BlockBallPlugin : JavaPlugin(), PluginProxy { return } - if (!getServerVersion().isCompatible( + val versions = if (versionFlag == "all") { + arrayOf( Version.VERSION_1_8_R3, Version.VERSION_1_9_R2, Version.VERSION_1_10_R1, @@ -89,10 +91,16 @@ class BlockBallPlugin : JavaPlugin(), PluginProxy { Version.VERSION_1_19_R3, Version.VERSION_1_20_R1, ) - ) { + } else { + arrayOf( + Version.VERSION_1_20_R1, + ) + } + + if (!getServerVersion().isCompatible(*versions)) { sendConsoleMessage(ChatColor.RED.toString() + "================================================") sendConsoleMessage(ChatColor.RED.toString() + "BlockBall does not support your server version") - sendConsoleMessage(ChatColor.RED.toString() + "Install v" + Version.VERSION_1_8_R3.id + " - v" + Version.VERSION_1_20_R1.id) + sendConsoleMessage(ChatColor.RED.toString() + "Install v" + versions[0].id + " - v" + versions[versions.size - 1].id) sendConsoleMessage(ChatColor.RED.toString() + "Plugin gets now disabled!") sendConsoleMessage(ChatColor.RED.toString() + "================================================") diff --git a/build.gradle b/build.gradle index 7c3f32b68..c3ffc4d6d 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ tasks.register("printVersion") { subprojects { group 'com.github.shynixn.blockball' - version '6.34.2' + version '6.34.3' sourceCompatibility = 1.8 @@ -121,16 +121,16 @@ subprojects { name = 'Shynixn' url = 'https://github.com/Shynixn' } - developer { - name = 'LazoYoung' - url = 'https://github.com/LazoYoung' - } } contributors { contributor { name = 'tildearrow' url = 'https://github.com/tildearrow' } + contributor { + name = 'LazoYoung' + url = 'https://github.com/LazoYoung' + } } scm { connection = 'scm:git:git://github.com/Shynixn/BlockBall.git'