diff --git a/lgsm/functions/check_ip.sh b/lgsm/functions/check_ip.sh index 49e5edb5a..bf7ea226c 100644 --- a/lgsm/functions/check_ip.sh +++ b/lgsm/functions/check_ip.sh @@ -24,20 +24,24 @@ getipwc=$(${ipcommand} -o -4 addr | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\ if [ -n "${ip}" ]&&[ "${ip}" != "0.0.0.0" ]; then queryips=( "${ip}" ) webadminip=( "${ip}" ) + telnetip=( "${ip}" ) # If game config does have an IP set. elif [ -n "${configip}" ]&&[ "${configip}" != "0.0.0.0" ];then queryips=( "${configip}" ) ip="${configip}" webadminip=( "${configip}" ) + telnetip=( "${configip}" ) # If there is only 1 server IP address. # Some IP details can automaticly use the one IP elif [ "${getipwc}" == "1" ]; then queryips=( $(echo "${getip}") ) ip="0.0.0.0" webadminip=( "${getip}" ) + telnetip=( "${getip}" ) # If no ip is set by the user and server has more than one IP. else queryips=( $(echo "${getip}") ) ip="0.0.0.0" webadminip=( "${ip}" ) + telnetip=( "${ip}" ) fi diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh index 8ed592881..f0e2bd062 100644 --- a/lgsm/functions/info_config.sh +++ b/lgsm/functions/info_config.sh @@ -1231,6 +1231,7 @@ fn_info_config_sdtd(){ telnetenabled="${unavailable}" telnetport="${zero}" telnetpass="${unavailable}" + telnetip="${unavailable}" maxplayers="${unavailable}" gamemode="${unavailable}" gameworld="${unavailable}" @@ -1246,7 +1247,11 @@ fn_info_config_sdtd(){ telnetenabled=$(grep "TelnetEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"") telnetport=$(grep "TelnetPort" "${servercfgfullpath}" | tr -cd '[:digit:]') telnetpass=$(grep "TelnetPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"") - + # Telnet IP will be localhost if no password is set + # check_ip will set the IP first. This will overwrite it. + if [ -z "${telnetpass}" ]; then + telnetip="127.0.0.1" + fi maxplayers=$(grep "ServerMaxPlayerCount" "${servercfgfullpath}" | tr -cd '[:digit:]') gamemode=$(grep "GameMode" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"") gameworld=$(grep "GameWorld" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"") diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index 6ecef11e3..3300eb348 100644 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -1123,7 +1123,7 @@ fn_info_message_sdtd(){ fn_messages_separator { echo -e "${lightblue}Telnet enabled:\t${default}${telnetenabled}" - echo -e "${lightblue}Telnet address:\t${default}${ip} ${telnetport}" + echo -e "${lightblue}Telnet address:\t${default}${telnetip} ${telnetport}" echo -e "${lightblue}Telnet password:\t${default}${telnetpass}" } | column -s $'\t' -t }