Skip to content

Commit

Permalink
paper download fallback to experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
nothub committed Nov 10, 2024
1 parent 6f76534 commit 2daccba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ mkdir -p run/server
cd run/server

if test ! -f "paper-${mc_version}.jar"; then
build_id="$(curl -s https://api.papermc.io/v2/projects/paper/versions/${mc_version}/builds \
| jq -r '.builds | map(select(.channel == "default") | .build) | .[-1]')"
json="$(curl -s https://api.papermc.io/v2/projects/paper/versions/${mc_version}/builds)"
build_id="$(echo "${json}" | jq -r '.builds | map(select(.channel == "default") | .build) | .[-1]')"
if test "${build_id}" = "null"; then
build_id="$(echo "${json}" | jq -r '.builds | map(select(.channel == "experimental") | .build) | .[-1]')"
echo >&2 "Downloading experimental paper build!"
fi
jar_url="https://api.papermc.io/v2/projects/paper/versions/${mc_version}/builds/${build_id}/downloads/paper-${mc_version}-${build_id}.jar"
curl -fsSL -o "paper-${mc_version}.jar" "${jar_url}"
fi
Expand Down

0 comments on commit 2daccba

Please sign in to comment.