Last active
September 21, 2022 20:16
-
-
Save yoshimov/0c080b2cdf4f38f0f877bcc56806eb03 to your computer and use it in GitHub Desktop.
check papermc builds and download latest jar file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# jq required | |
API="https://papermc.io/api/v2/projects/paper" | |
VER="1.17.1" | |
BUILDS_JSON=$(curl -s $API/versions/$VER) | |
#echo $BUILDS_JSON | |
LATEST=$(echo $BUILDS_JSON | jq '.builds[-1]') | |
PFILE="paper-$VER-$LATEST.jar" | |
if [ -e $PFILE ]; then | |
echo "latest file exists: $PFILE" | |
else | |
URL="$API/versions/$VER/builds/$LATEST/downloads/$PFILE" | |
wget "$URL" | |
if [ -e $PFILE ]; then | |
echo "update paper server: $PFILE" | |
rm -vf server.jar | |
ln -sv $PFILE server.jar | |
else | |
echo "fail to download: $URL" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment