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." }