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
This commit is contained in:
==TIM.©.B == 2025-06-23 11:06:25 +02:00 committed by GitHub
parent a01ade7b32
commit a23067e60d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)"