#!/bin/bash
if [ ! -d /mnt/server ]; then
mkdir /mnt/server
fi
cd /mnt/server
if [[ "${SERVER_JARFILE}" == "*\.jar" ]]; then
echo -e "adding.jar to server file name"
SERVER_JARFILE="${SERVER_JARFILE}.jar"
fi
if [ -z "${WATERDOG_VERSION}" ] || [ "${WATERDOG_VERSION}" == "latest" ]; then
echo -e "downloading latest waterdog pe build\n"
curl -sSL -o ${SERVER_JARFILE} https://jenkins.waterdog.dev/job/Waterdog/job/WaterdogPE/job/release/lastSuccessfulBuild/artifact/target/Waterdog.jar
else
echo -e "downloading waterdog pe build ${WATERDOG_VERSION}\n"
curl -sSL -o ${SERVER_JARFILE} https://jenkins.waterdog.dev/job/Waterdog/job/WaterdogPE/job/release/${WATERDOG_VERSION}/artifact/target/Waterdog.jar
fi
if [ ! -f config.yml ]; then
echo -e "Downloading waterdog pe config.yml"
curl -o config.yml https://raw.githubusercontent.com/ptero-eggs/game-eggs/main/minecraft/proxy/bedrock/waterdog_pe/config.yml
else
echo -e "Waterfall config.yml exists. Will not pull a new file"
fi
echo "-----------------------------------------"
echo "Installation completed..."
echo "-----------------------------------------"