Update initialization and server startup code

This commit is contained in:
JeremyStar™ 2024-04-20 17:08:06 +02:00
parent 643609aa43
commit 166247c4bf
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -57,10 +57,6 @@ function initialize() {
export "MCSD_SAFEMODE=false"
fi
# MCSD functionality
if [ ! "${MCSD_AUTO_RESTART}" == "true" ] && [ ! "${MCSD_AUTO_RESTART}" == "false" ]; then
echo ":: Warning: No/Invalid value supplied to \$MCSD_AUTO_RESTART, defaulting to false"
export "MCSD_AUTO_RESTART=false"
fi
if [ ! "${MCSD_CLEAN_LOGS}" == "true" ] && [ ! "${MCSD_CLEAN_LOGS}" == "false" ]; then
echo ":: Warning: No/Invalid value supplied to \$MCSD_CLEAN_LOGS, defaulting to false"
export "MCSD_CLEAN_LOGS=false"
@ -162,17 +158,6 @@ function compile_flags() {
esac
}
# Starts the server
function run() {
echo ":: Starting server"
cd /data||exit 69
# We want to use ${ARGS} without using parenthesis
# shellcheck disable=SC2086
exec "/usr/lib/jvm/java-${MCSD_JAVA_VERSION}-openjdk/bin/java" ${FLAGS} -jar "/data/server.jar" ${ARGS}
}
# Need I say more?
function main() {
print_banner
initialize
check
@ -180,7 +165,7 @@ function main() {
clean_logs
compile_args
compile_flags
run
}
main
echo ":: Starting server"
cd /data||exit 69
exec "/usr/lib/jvm/java-${MCSD_JAVA_VERSION}-openjdk/bin/java" ${FLAGS} -jar "/data/server.jar" ${ARGS}