Files
docker-minecraft-server/scripts/start-deploySpongeVanilla
T

51 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# shellcheck source=start-utils
. "$(dirname "$0")/start-utils"
export TYPE=spongevanilla
: ${SPONGEBRANCH:=STABLE}
: ${SPONGEVERSION:=}
# Parse branch
log "Choosing branch for Sponge"
case "$SPONGEBRANCH" in
EXPERIMENTAL|experimental|BLEEDING|bleeding)
SPONGEBRANCH=bleeding
;;
*)
SPONGEBRANCH=stable
;;
esac
# If not SPONGEVERSION selected, detect last version on selected branch
if [ -z "$SPONGEVERSION" ]; then
log "Choosing Version for Sponge"
if ! SPONGEVERSION=$(curl -fsSL "https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE" | jq -r --arg SPONGEBRANCH "$SPONGEBRANCH" '.buildTypes[$SPONGEBRANCH].latest.version'); then
logError "Failed to resolve latest SpongeVanilla version from the Sponge downloads API"
exit 1
fi
if [[ -z $SPONGEVERSION || $SPONGEVERSION == null ]]; then
logError "Sponge downloads API did not return a version for branch $SPONGEBRANCH"
exit 1
fi
fi
VERSION="$SPONGEVERSION"
export VERSION
export SERVER="spongevanilla-$SPONGEVERSION.jar"
if [ ! -e "$SERVER" ] || isTrue "${FORCE_REDOWNLOAD}"; then
log "Downloading $SERVER ..."
if ! curl -fsSL -o "$SERVER" "https://repo.spongepowered.org/maven/org/spongepowered/$TYPE/$SPONGEVERSION/$SERVER"; then
logError "Failed to download $SERVER"
exit 1
fi
fi
export FAMILY=SPONGE
exec "$(dirname "$0")/start-setupWorld" "$@"