Skip to content

Commit a23067e

Browse files
authored
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
1 parent a01ade7 commit a23067e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

update.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/bash
22

3-
# Change to Minecraft directory
43
cd /opt/minecraft || exit 1
54

6-
# Download latest PaperMC jar (manually specified version/build for now)
7-
wget -O server.jar https://api.papermc.io/v2/projects/paper/versions/1.20.4/builds/416/downloads/paper-1.20.4-416.jar
5+
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r '.versions | last')
6+
LATEST_BUILD=$(curl -s https://api.papermc.io/v2/projects/paper/versions/$LATEST_VERSION | jq -r '.builds | last')
87

9-
echo "✅ Update complete. Restart the server if needed."
8+
wget -O server.jar "https://api.papermc.io/v2/projects/paper/versions/$LATEST_VERSION/builds/$LATEST_BUILD/downloads/paper-$LATEST_VERSION-$LATEST_BUILD.jar"
9+
10+
echo "✅ Update complete to version $LATEST_VERSION (build $LATEST_BUILD)"

0 commit comments

Comments
 (0)