Use error_exit() to report eula error message

This commit is contained in:
Marcus Whybrow 2015-07-25 07:47:58 +01:00
parent 52a0581d10
commit 0455eb0236

View File

@ -158,6 +158,7 @@ error_exit() {
CONF_ERROR) code=73;;
FATAL_ERROR) code=74;;
JAVA_NOT_INSTALLED) code=75;;
EULA_UNACCEPTED) code=76;;
esac
echo "${2:-"Unknown Error"}" 1>&2
@ -1422,13 +1423,12 @@ server_start() {
# Wait for the server to fully start
server_log_dots_for_lines "$1" "$time_now" "${SERVER_CONSOLE_EVENT_OUTPUT_START[$1]}" "${SERVER_CONSOLE_EVENT_TIMEOUT_START[$1]}"
if [[ -f "${SERVER_PATH[$1]}"/eula.txt ]]; then
if ! grep -q -i 'eula=true' "${SERVER_PATH[$1]}"/eula.txt; then
echo " You need to agree to the EULA in order to run the server. Go to eula.txt for more info."
return
fi
fi
if [[ -f "${SERVER_PATH[$1]}"/eula.txt ]]; then
if ! grep -q -i 'eula=true' "${SERVER_PATH[$1]}"/eula.txt; then
error_exit EULA_UNACCEPTED "Could not start the server as you first need to agree to a EULA. See eula.txt for more info."
fi
fi
echo " Done."
fi