SubServers-2/SubServers.Creator/src/Paper/build.sh

34 lines
742 B
Bash
Raw Normal View History

2019-12-18 06:08:59 +01:00
# SubCreator Paper Build Script
#
#!/usr/bin/env bash
if [[ -z "$version" ]]
then
echo ERROR: No Build Version Supplied
rm -Rf "$0"
exit 1
fi
function __DL() {
if [[ -x "$(command -v wget)" ]]; then
wget -O "$1" "$2"; return $?
else
curl -o "$1" "$2"; return $?
fi
}
echo Downloading Paper...
if [[ -f "Paper.jar" ]]; then
if [[ -f "Paper.old.jar.x" ]]; then
rm -Rf Paper.old.jar.x
fi
mv Paper.jar Paper.old.jar.x
fi
__DL Paper.jar "https://papermc.io/api/v1/paper/$version/latest/download"; __RETURN=$?
if [[ $__RETURN -eq 0 ]]; then
echo Cleaning Up...
rm -Rf "$0"
exit 0
else
echo ERROR: Failed downloading Paper. Is PaperMC.io down?
rm -Rf "$0"
exit 3
fi
exit 2