Files
dockercraft/scripts/lib/loaders/vanilla.sh
T
jeremy 5688b30892 fix: migrate PaperMC to v3 API, fix NeoForge beta fallback, add test suite
- 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
2026-08-21 12:49:27 -04:00

39 lines
1.2 KiB
Bash

getVanilla() {
SERVER_TYPE="Vanilla Minecraft"
if [[ -z "${MC_VERSION}" ]]; then
die "MC_VERSION is required for Vanilla loader"
fi
log "Fetching Mojang version manifest..."
local MANIFEST
MANIFEST=$(curl -sf --connect-timeout 10 --max-time 30 \
"https://launchermeta.mojang.com/mc/game/version_manifest.json") || true
if [[ -z "$MANIFEST" ]]; then
die "Could not fetch Mojang version manifest"
fi
local VERSION_URL
VERSION_URL=$(echo "$MANIFEST" | jq -r ".versions[] | select(.id == \"${MC_VERSION}\") | .url")
if [[ -z "$VERSION_URL" || "$VERSION_URL" == "null" ]]; then
die "Version ${MC_VERSION} not found in Mojang manifest"
fi
local VERSION_DATA DOWNLOAD_URL
VERSION_DATA=$(curl -sf --connect-timeout 10 --max-time 30 "$VERSION_URL") || true
if [[ -z "$VERSION_DATA" ]]; then
die "Could not fetch version data for ${MC_VERSION}"
fi
DOWNLOAD_URL=$(echo "$VERSION_DATA" | jq -r ".downloads.server.url")
if [[ -z "$DOWNLOAD_URL" || "$DOWNLOAD_URL" == "null" ]]; then
die "No server download URL found for ${MC_VERSION}"
fi
log "Downloading Vanilla ${MC_VERSION} server..."
curl -fL -o server.jar "$DOWNLOAD_URL"
log "Vanilla ${MC_VERSION} downloaded."
}