Skip to content

Instantly share code, notes, and snippets.

@yoshimov
Last active September 21, 2022 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yoshimov/0c080b2cdf4f38f0f877bcc56806eb03 to your computer and use it in GitHub Desktop.
Save yoshimov/0c080b2cdf4f38f0f877bcc56806eb03 to your computer and use it in GitHub Desktop.
check papermc builds and download latest jar file.
#!/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