19 lines
1.1 KiB
Bash
Executable file
19 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
# original script by https://github.com/TheRemote/RaspberryPiMinecraft/blob/master/SetupMinecraft.sh
|
|
# modified with jq
|
|
set -euxo pipefail
|
|
Version=$1
|
|
BuildJSON=$(curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4.212 Safari/537.36" https://api.papermc.io/v2/projects/paper/versions/$Version/builds)
|
|
|
|
if [[ "${1:-}" == "1.21.4" ]] ; then
|
|
Build=$(echo "$BuildJSON" | jq '[.builds[] | select(.channel == "default" or .channel == "experimental")][-1].build')
|
|
else
|
|
Build=$(echo "$BuildJSON" | jq '[.builds[] | select(.channel == "default")][-1].build')
|
|
fi
|
|
|
|
|
|
echo $BuildJSON | jq
|
|
curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4.212 Safari/537.36" -o paperclip.jar "https://api.papermc.io/v2/projects/paper/versions/$Version/builds/$Build/downloads/paper-$Version-$Build.jar"
|
|
echo -----------------
|
|
echo $1#$Build
|
|
echo -----------------
|