summaryrefslogtreecommitdiff
path: root/papermc_getlatest.sh
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-04-22 23:29:38 +0200
committerBotond Hende <nettingman@gmail.com>2024-04-22 23:29:38 +0200
commit408ace2b1031b152baf55a01e490f227fa3b5437 (patch)
tree00e2cab7f43707c0f6920f5c4d5c82f14ae578cf /papermc_getlatest.sh
initial commit
Diffstat (limited to 'papermc_getlatest.sh')
-rwxr-xr-xpapermc_getlatest.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/papermc_getlatest.sh b/papermc_getlatest.sh
new file mode 100755
index 0000000..f8d0ca9
--- /dev/null
+++ b/papermc_getlatest.sh
@@ -0,0 +1,13 @@
+PROJECT="paper"
+MINECRAFT_VERSION="1.20.4"
+
+LATEST_BUILD=$(curl -s https://api.papermc.io/v2/projects/${PROJECT}/versions/${MINECRAFT_VERSION}/builds | \
+ jq -r '.builds | map(select(.channel == "default") | .build) | .[-1]')
+
+JAR_NAME=${PROJECT}-${MINECRAFT_VERSION}-${LATEST_BUILD}.jar
+
+PAPERMC_URL="https://api.papermc.io/v2/projects/${PROJECT}/versions/${MINECRAFT_VERSION}/builds/${LATEST_BUILD}/downloads/${JAR_NAME}"
+
+# Download the latest PaperMC version
+curl -o /opt/minecraft/server.jar $PAPERMC_URL
+echo "Downloads completed"