- Migrate Paper loader from sunset v2 API to v3 (fill.papermc.io) - Fix NeoForge: fall back to beta versions when no stable exists (set -e + grep) - Fix setEula/setperms ordering (was writing eula.txt before /data was writable) - Fix setEula/serverInfoWrite to use absolute paths (/data/server/) - Add VOLUME directive removal (was shadowing bind mounts) - Add comprehensive API test suite (110 tests across 6 suites) - Move test.sh to tests/integration.sh, switch to named volumes - Add Docker build cache to CI workflows - Add .editorconfig, expand .gitignore, improve README docs
60 lines
1.9 KiB
Bash
60 lines
1.9 KiB
Bash
getPaper() {
|
|
SERVER_TYPE="Paper Minecraft"
|
|
|
|
if [[ -z "${MC_VERSION}" ]]; then
|
|
die "MC_VERSION is required for Paper loader"
|
|
fi
|
|
|
|
if [[ -f server.jar ]]; then
|
|
log "Paper server.jar already exists, skipping download."
|
|
return
|
|
fi
|
|
|
|
local PAPERMC_URL
|
|
|
|
if [[ -n "${PAPER_BUILD}" ]]; then
|
|
log "Fetching Paper build ${PAPER_BUILD} for MC ${MC_VERSION}..."
|
|
local BUILD_DATA
|
|
BUILD_DATA=$(curl -sf --connect-timeout 10 --max-time 30 \
|
|
-H "User-Agent: dockercraft/1.0" \
|
|
"https://fill.papermc.io/v3/projects/paper/versions/${MC_VERSION}/builds") || true
|
|
|
|
if [[ -n "$BUILD_DATA" ]]; then
|
|
PAPERMC_URL=$(echo "$BUILD_DATA" | jq -r \
|
|
"map(select(.id == ${PAPER_BUILD})) | .[0].downloads.\"server:default\".url // empty")
|
|
fi
|
|
|
|
if [[ -z "$PAPERMC_URL" ]]; then
|
|
die "Paper build ${PAPER_BUILD} not found for MC ${MC_VERSION}"
|
|
fi
|
|
else
|
|
log "Querying PaperMC API for latest stable build of ${MC_VERSION}..."
|
|
local BUILDS_DATA
|
|
BUILDS_DATA=$(curl -sf --connect-timeout 10 --max-time 30 \
|
|
-H "User-Agent: dockercraft/1.0" \
|
|
"https://fill.papermc.io/v3/projects/paper/versions/${MC_VERSION}/builds") || true
|
|
|
|
if [[ -z "$BUILDS_DATA" ]]; then
|
|
die "Could not fetch Paper builds for MC ${MC_VERSION}"
|
|
fi
|
|
|
|
# Check for API error
|
|
if echo "$BUILDS_DATA" | jq -e '.ok == false' >/dev/null 2>&1; then
|
|
local ERR_MSG
|
|
ERR_MSG=$(echo "$BUILDS_DATA" | jq -r '.message // "Unknown error"')
|
|
die "PaperMC API error: ${ERR_MSG}"
|
|
fi
|
|
|
|
PAPERMC_URL=$(echo "$BUILDS_DATA" | jq -r \
|
|
'first(.[] | select(.channel == "STABLE") | .downloads."server:default".url) // empty')
|
|
|
|
if [[ -z "$PAPERMC_URL" ]]; then
|
|
die "No stable Paper build found for MC ${MC_VERSION}"
|
|
fi
|
|
fi
|
|
|
|
log "Downloading Paper for MC ${MC_VERSION}..."
|
|
curl -fL -o server.jar "$PAPERMC_URL"
|
|
log "Paper for MC ${MC_VERSION} downloaded."
|
|
}
|