Moved the server.properties checking to it's own function, read_server_conf().

This commit is contained in:
Tristan Donkers 2015-08-23 11:26:30 +10:00
parent ef2a6c537c
commit f4d0c14aab

View File

@ -1826,6 +1826,23 @@ server_property() {
fi fi
# If not a non-overridable load from conf # If not a non-overridable load from conf
read_server_conf "$1" "$2"
local target_varname=SERVER_$2[$1]
if [ -z ${!target_varname} ]; then
# if its still empty use the default value
manager_property "DEFAULT_$2"
server_set_property "$1" "$2" "\$SETTINGS_DEFAULT_$2"
fi
fi
}
#Checks server config for overriding value
# $1: The ID of the server
# $2: The name of the server property
read_server_conf(){
server_property "$1" CONF
to_properties_name "$2" to_properties_name "$2"
local name="$RETURN" local name="$RETURN"
@ -1835,19 +1852,12 @@ server_property() {
name="msm-$name" name="msm-$name"
fi fi
server_property "$1" CONF
local from_conf="$(sed -rn "s/^$name=('|\"|)(.*)\1/\2/ip" "${SERVER_CONF[$1]}" | tail -n 1)" local from_conf="$(sed -rn "s/^$name=('|\"|)(.*)\1/\2/ip" "${SERVER_CONF[$1]}" | tail -n 1)"
if [ ! -z "$from_conf" ]; then if [ ! -z "$from_conf" ]; then
# If the value is found in the server conf file (server.properties) # If the value is found in the server conf file (server.properties)
# then set that as value for the property # then set that as value for the property
server_set_property "$1" "$2" "$from_conf" server_set_property "$1" "$2" "$from_conf"
else
# Otherwise use the default value
manager_property "DEFAULT_$2"
server_set_property "$1" "$2" "\$SETTINGS_DEFAULT_$2"
fi
fi fi
} }