From a23067e60d3a20b1d1817920dfc540633256fef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=3D=3DTIM=2E=C2=A9=2EB=20=20=3D=3D?= Date: Mon, 23 Jun 2025 11:06:25 +0200 Subject: [PATCH] Update update.sh feat: add dynamic PaperMC update.sh with API-based version & build resolution - Uses PaperMC API to fetch latest version and build - Replaces existing server.jar in /opt/minecraft - Includes status output after update - Designed for standalone use by minecraft user --- update.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/update.sh b/update.sh index 2e283ed..a7b53d6 100644 --- a/update.sh +++ b/update.sh @@ -1,9 +1,10 @@ #!/bin/bash -# Change to Minecraft directory cd /opt/minecraft || exit 1 -# Download latest PaperMC jar (manually specified version/build for now) -wget -O server.jar https://api.papermc.io/v2/projects/paper/versions/1.20.4/builds/416/downloads/paper-1.20.4-416.jar +LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r '.versions | last') +LATEST_BUILD=$(curl -s https://api.papermc.io/v2/projects/paper/versions/$LATEST_VERSION | jq -r '.builds | last') -echo "✅ Update complete. Restart the server if needed." +wget -O server.jar "https://api.papermc.io/v2/projects/paper/versions/$LATEST_VERSION/builds/$LATEST_BUILD/downloads/paper-$LATEST_VERSION-$LATEST_BUILD.jar" + +echo "✅ Update complete to version $LATEST_VERSION (build $LATEST_BUILD)"