docker-minecraft-server/scripts/start-deployPaper

64 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
set -o pipefail
handleDebugMode
: "${PAPER_PROJECT:=paper}"
: "${PAPER_BUILD:=${PAPERBUILD:-}}"
: "${PAPER_CHANNEL:=default}"
: "${PAPER_DOWNLOAD_URL:=}"
: "${PAPER_CUSTOM_JAR:=}"
: "${PAPER_CONFIG_DEFAULTS_REPO:=https://raw.githubusercontent.com/dayyeeet/minecraft-default-configs/main}"
resultsFile=/data/.paper.env
if [[ $PAPER_CUSTOM_JAR ]]; then
export SERVER="$PAPER_CUSTOM_JAR"
elif [[ $PAPER_DOWNLOAD_URL ]]; then
if ! mc-image-helper install-paper \
--output-directory=/data \
--results-file="$resultsFile" \
--url="$PAPER_DOWNLOAD_URL"; then
log "ERROR: failed to download from custom PaperMC URL"
exit 1
fi
# grab SERVER and export it
set -a
# shellcheck disable=SC1090
source "${resultsFile}"
set +a
else
args=(
--output-directory=/data
--results-file="$resultsFile"
--project="$PAPER_PROJECT"
--version="$VERSION"
--channel="$PAPER_CHANNEL"
)
if [[ $PAPER_BUILD ]]; then
args+=(--build="$PAPER_BUILD")
fi
if ! mc-image-helper install-paper "${args[@]}"; then
log "ERROR: failed to download $PAPER_PROJECT"
exit 1
fi
# grab SERVER and export it
set -a
# shellcheck disable=SC1090
source "${resultsFile}"
set +a
fi
# Download default configs to allow for consistent patching
for c in paper-global.yml paper-world-defaults.yml spigot.yml; do
DOWNLOAD_DEFAULT_CONFIGS+=",${PAPER_CONFIG_DEFAULTS_REPO}/${VERSION}/$c"
done
export DOWNLOAD_DEFAULT_CONFIGS
# Normalize on Spigot for downstream operations
export FAMILY=SPIGOT
exec "${SCRIPTS:-/}start-spiget" "$@"