Browse Source

Added JC3 servername and description

Daniel Gibbs 8 years ago
parent
commit
ba143835c6
2 changed files with 9 additions and 0 deletions
  1. 4 0
      lgsm/functions/info_config.sh
  2. 5 0
      lgsm/functions/info_messages.sh

+ 4 - 0
lgsm/functions/info_config.sh

@@ -41,6 +41,7 @@ fn_info_config_justcause2(){
 fn_info_config_justcause3(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"
+		serverdescription="${unavailable}"
 		serverpassword="${unavailable}"
 		maxplayers="${zero}"
 		port="${zero}"
@@ -48,6 +49,8 @@ fn_info_config_justcause3(){
 		steamport="${zero}"
 		tickrate="${zero}"
 	else
+		servername=$(grep "name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		serverdescription=$(grep "description" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/description//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
 		serverpassword=$(grep "password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
 		maxplayers=$(grep "\"maxPlayers\"" "${servercfgfullpath}" | tr -cd '[:digit:]')
 		port=$(grep "\"port\"" "${servercfgfullpath}" | tr -cd '[:digit:]')
@@ -61,6 +64,7 @@ fn_info_config_justcause3(){
 
 		# Not Set
 		servername=${servername:-"NOT SET"}
+		serverdescription=${servername:-"NOT SET"}
 		serverpassword=${serverpassword:-"NOT SET"}
 		maxplayers=${maxplayers=:-"0"}
 		port=${port=:-"0"}

+ 5 - 0
lgsm/functions/info_messages.sh

@@ -126,6 +126,11 @@ fn_info_message_gameserver(){
 			echo -e "${blue}Server name:\t${default}${servername}"
 		fi
 
+		# Server description
+		if [ -n "${serverdescription}" ]; then
+			echo -e "${blue}Server name:\t${default}${serverdescription}"
+		fi
+
 		# Branch
 		if [ -n "${branch}" ]; then
 			echo -e "${blue}Branch:\t${default}${branch}"