Daniel Gibbs 9 лет назад
Родитель
Сommit
f9e07e053e
2 измененных файлов с 33 добавлено и 0 удалено
  1. 11 0
      lgsm/functions/command_details.sh
  2. 22 0
      lgsm/functions/info_config.sh

+ 11 - 0
lgsm/functions/command_details.sh

@@ -337,6 +337,15 @@ fn_details_dontstarve(){
 	} | column -s $'\t' -t
 }
 
+fn_details_minecraft(){
+	echo -e "netstat -atunp | grep java"
+	echo -e ""
+	{
+		echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+		echo -e "> Game\tINBOUND\t${port}\tudp"
+	} | column -s $'\t' -t
+}
+
 fn_details_projectzomboid(){
 	echo -e "netstat -atunp | grep java"
 	echo -e ""
@@ -591,6 +600,8 @@ if [ "${engine}" == "avalanche" ]; then
 	fn_details_avalanche
 elif [ "${engine}" == "dontstarve" ]; then
 	fn_details_dontstarve
+elif [ "${engine}" == "minecraft" ]; then
+	fn_details_minecraft
 elif [ "${engine}" == "projectzomboid" ]; then
 	fn_details_projectzomboid
 elif [ "${engine}" == "idtech3" ]; then

+ 22 - 0
lgsm/functions/info_config.sh

@@ -68,6 +68,28 @@ fn_info_config_dontstarve(){
 	fi
 }
 
+fn_info_config_minecraft(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		rconpassword="${unavailable}"
+		slots="${zero}"
+		port="${zero}"
+	else
+		# check if the ip exists in the config file. Failing this will fall back to the default.
+		ipconfigcheck=$(grep "server-ip=" "${servercfgfullpath}" | sed 's/server-ip=//g')
+		if [ -n "${ipconfigcheck}" ]; then
+			ip="${ipconfigcheck}"
+		fi
+		rconpassword=$(grep "rcon.password=" "${servercfgfullpath}" | sed 's/rcon.password=//g' | tr -d '\')
+		slots=$(grep "max-players=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+		port=$(grep "server-port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+
+		# Not Set
+		rconpassword=${rconpassword:-"NOT SET"}
+		slots=${slots:-"NOT SET"}
+		port=${port:-"NOT SET"}
+	fi
+}
+
 fn_info_config_projectzomboid(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"