2023-04-03 21:09:18 +02:00

56 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
if test "$EULA" != "true"; then
echo "You need to accept the Mojang EULA (using -e EULA=true) to run the server"
exit 1
fi
meta_dir="docker_meta"
if test ! -f "$meta_dir/setup_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 "Setup is done"
fi
version=$1
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