From f9e07e053e9ab05c243bf6a51702a0750b897817 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 8 Aug 2016 21:29:40 +0100 Subject: [PATCH] Updated minecraft details --- lgsm/functions/command_details.sh | 11 +++++++++++ lgsm/functions/info_config.sh | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh index df3e49e6a..43d6cb03e 100644 --- a/lgsm/functions/command_details.sh +++ b/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 diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh index 1f754d62d..558f98d10 100644 --- a/lgsm/functions/info_config.sh +++ b/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}"