velocity-dockerized/paper/bin/configure_and_start

55 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
meta_dir="docker_meta"
if test ! -f "$meta_dir/config_done"; then
# TODO: Use config/paper-global.yml with new config keys for 1.19+ Paper
config_path="paper.yml"
config=""
if test "$VELOCITY_ENABLE" = "true"; then
echo "online-mode=false" > server.properties
velocity=$(cat << EOF
settings:
velocity-support:
enabled: true
online-mode: true
secret: '$VELOCITY_SECRET'
EOF
)
config="${config}${velocity}"
fi
if test ! -z "$config"; then
echo "Writing config"
echo "$config" > $config_path
fi
mkdir -p "$meta_dir" && touch "$meta_dir/setup_done"
else
echo "Configuration is done"
fi
echo $MC_VERSION
version=$MC_VERSION
echo "Downloading version $version"
apiURL=https://api.papermc.io/v2/projects/paper
build=$(curl -X GET $apiURL/versions/$version/builds | jq -r ".builds[-1].build")
echo "Build is $build"
url=$apiURL/versions/$version/builds/$build/downloads/paper-$version-$build.jar
echo "Full URL is: $url"
echo "Downloading to $PWD"
wget -O paper.jar $url
echo "eula=true" > eula.txt
echo "> $@"
exec "$@"