Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@JoshuaJB
Created July 6, 2022 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshuaJB/d2884985954d47cdf23ffbd86986744a to your computer and use it in GitHub Desktop.
Save JoshuaJB/d2884985954d47cdf23ffbd86986744a to your computer and use it in GitHub Desktop.
Display and download the latest build of the latest stable version of PaperMC. Simple, easy updater for any PaperMC-using server.
#!/bin/sh
# This script downloads the latest build of the latest version of PaperMC
if [ $# -eq 1 ]; then
latest_v=$1
else
latest_v=$(curl -sX GET "https://api.papermc.io/v2/projects/paper" | jq -r ".versions[-1]")
fi
# Lastest build of any sort
#latest_b=$(curl -sX GET "https://api.papermc.io/v2/projects/paper/versions/$latest_v" | jq -r ".builds[-1]")
# Latest "default" build
latest_b=$(curl -sX GET "https://api.papermc.io/v2/projects/paper/versions/$latest_v/builds" | jq '[.builds| .[] | select(.channel=="default").build] | max')
# Print some info about what we're downloading
echo "Download build $latest_b of version $latest_v? Full details:"
curl -sX GET "https://api.papermc.io/v2/projects/paper/versions/$latest_v/builds" | jq '.builds| .[] | select(.build=='$latest_b')'
tmp=""
read -p "Press enter to continue..." tmp
build_name=$(curl -sX GET "https://api.papermc.io/v2/projects/paper/versions/1.19/builds" | jq -r '.builds| .[] | select(.build==51).downloads.application.name')
wget "https://api.papermc.io/v2/projects/paper/versions/$latest_v/builds/$latest_b/downloads/$build_name" -O $build_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment