diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml new file mode 100644 index 0000000..2c525da --- /dev/null +++ b/.github/workflows/prerelease.yml @@ -0,0 +1,48 @@ +name: Deploy Pre-Release to Polymart + +on: + push: + branches: + - dev + + +jobs: + build: + runs-on: ubuntu-latest + environment: polymart_deploy + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + - name: Change version to include build + run: | + export OLD_VERSION=`cat build.gradle.kts | grep "version " | awk -F'"' '{print $2}'` + export NEW_VERSION=$OLD_VERSION-b${{github.run_number}} + (cat build.gradle.kts | sed "s/$OLD_VERSION/$NEW_VERSION/") > temp.txt + mv temp.txt build.gradle.kts + echo Version number is now $(cat build.gradle.kts | grep "version " | awk -F'"' '{print $2}') - $NEW_VERSION + cat build.gradle.kts + - name: Build with Gradle + uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7 + with: + arguments: :free:shadowJar :premium:shadowJar + - name: Upload build files artifact + uses: actions/upload-artifact@v2.3.1 + with: + # Artifact name + name: build-files + # A file, directory or wildcard pattern that describes what to upload + path: '*/build/*' + # The desired behavior if no files are found using the provided path. + if-no-files-found: error + retention-days: 2 + - name: Deploy to Polymart + env: + POLYMART_TOKEN: ${{ secrets.POLYMART_TOKEN }} + run: | + export VERSION=`cat build.gradle.kts | grep "version " | awk -F'"' '{print $2}'` + file free/build/libs/ajQueue-$VERSION.jar + curl -F "file=@free/build/libs/ajQueue-$VERSION.jar" -F api_key=$POLYMART_TOKEN -F resource_id="2535" -F version="$VERSION" -F title="Pre-release v$VERSION" -F beta=1 -F message=$'Note: This is a (most likely) un-tested build. It is not guarenteed to work!\n\nChange since previous build:\n[url=${{ github.event.compare }}"]${{ github.event.head_commit.message }}[/url]' "https://api.polymart.org/v1/postUpdate" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ee2c511 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: Deploy Release to Polymart + +on: + push: + branches: + - master + + +jobs: + build: + runs-on: ubuntu-latest + environment: polymart_deploy + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + - name: Build with Gradle + uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7 + with: + arguments: :free:shadowJar :premium:shadowJar + - name: Upload build files artifact + uses: actions/upload-artifact@v2.3.1 + with: + # Artifact name + name: build-files + # A file, directory or wildcard pattern that describes what to upload + path: '*/build/*' + # The desired behavior if no files are found using the provided path. + if-no-files-found: error + retention-days: 2 + - name: Download changelogs + run: | + curl "https://ajg0702.us/pl/updater/changelogs.php?project=${{ github.repository }}" > changelogs.bb + - name: Deploy to Polymart + env: + POLYMART_TOKEN: ${{ secrets.POLYMART_TOKEN }} + run: | + export VERSION=`cat build.gradle.kts | grep "version " | awk -F'"' '{print $2}'` + file free/build/libs/ajQueue-$VERSION.jar + curl -F "file=@free/build/libs/ajQueue-$VERSION.jar" -F api_key=$POLYMART_TOKEN -F resource_id="2535" -F version="$VERSION" -F title="v$VERSION" -F message="$(cat changelogs.bb)" "https://api.polymart.org/v1/postUpdate" diff --git a/build.gradle.kts b/build.gradle.kts index 9f99f79..4cd58f0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,7 +12,7 @@ repositories { } allprojects { - version = "2.2.8" + version = "2.2.9" group = "us.ajg0702" plugins.apply("java") diff --git a/common/src/main/java/us/ajg0702/queue/commands/commands/listqueues/ListCommand.java b/common/src/main/java/us/ajg0702/queue/commands/commands/listqueues/ListCommand.java index 29d4e0e..53132e3 100644 --- a/common/src/main/java/us/ajg0702/queue/commands/commands/listqueues/ListCommand.java +++ b/common/src/main/java/us/ajg0702/queue/commands/commands/listqueues/ListCommand.java @@ -68,10 +68,10 @@ public class ListCommand extends BaseCommand { m = m.append(Component.text("\n")); m = m.append(main.getMessages().getComponent("commands.listqueues.format", - "COLOR:" + main.getMessages().color(color), + "COLOR:" + Messages.color(color), "NAME:" + s.getAlias(), "COUNT:" + s.getQueue().size(), - "STATUS:" + s.getStatusString(spp) + "STATUS:" + main.getMessages().getRawString("placeholders.status."+s.getStatus(spp)) )); } sender.sendMessage(m); diff --git a/common/src/main/java/us/ajg0702/queue/common/QueueManagerImpl.java b/common/src/main/java/us/ajg0702/queue/common/QueueManagerImpl.java index 22beb0f..2da51d1 100644 --- a/common/src/main/java/us/ajg0702/queue/common/QueueManagerImpl.java +++ b/common/src/main/java/us/ajg0702/queue/common/QueueManagerImpl.java @@ -118,7 +118,11 @@ public class QueueManagerImpl implements QueueManager { versions.append(msgs.getString("errors.wrong-version.comma")); } } - player.sendMessage(msgs.getComponent("errors.wrong-version.base", "VERSIONS:" + versions)); + player.sendMessage(msgs.getComponent( + "errors.wrong-version.base", + "VERSIONS:" + versions, + "SERVER:"+server.getAlias() + )); return false; } @@ -352,7 +356,8 @@ public class QueueManagerImpl implements QueueManager { AdaptedPlayer player = queuePlayer.getPlayer(); if(player == null) continue; - if(!getSingleServer(player).equals(server)) continue; + QueueServer singleServer = getSingleServer(player); + if(singleServer == null || !singleServer.equals(server)) continue; if(!server.isJoinable(player)) { player.sendActionBar(msgs.getComponent("spigot.actionbar.offline", @@ -380,7 +385,6 @@ public class QueueManagerImpl implements QueueManager { if(!main.getConfig().getBoolean("send-title")) return; for(QueueServer server : servers) { - String status = server.getStatusString(); for(QueuePlayer queuePlayer : server.getQueue()) { int pos = queuePlayer.getPosition(); @@ -392,7 +396,10 @@ public class QueueManagerImpl implements QueueManager { AdaptedPlayer player = queuePlayer.getPlayer(); if(player == null) continue; - if(!getSingleServer(player).equals(server)) continue; + QueueServer singleServer = getSingleServer(player); + if(singleServer == null || !singleServer.equals(server)) continue; + + String status = Messages.color(main.getMessages().getRawString("placeholders.status."+server.getStatus(player))); int time = (int) Math.round(pos * main.getTimeBetweenPlayers()); diff --git a/spigot/src/main/resources/plugin.yml b/spigot/src/main/resources/plugin.yml index afc875e..4b70578 100644 --- a/spigot/src/main/resources/plugin.yml +++ b/spigot/src/main/resources/plugin.yml @@ -5,8 +5,8 @@ author: ajgeiss0702 name: ajQueue softdepend: [PlaceholderAPI] commands: - move: - aliases: [server, queue, joinq, joinqueue] + queue: + aliases: [server, move, joinq, joinqueue] description: Queue for a server leavequeue: aliases: [leaveq]