diff --git a/lgsm/functions/query_gamedig.sh b/lgsm/functions/query_gamedig.sh index 285cf0805..071645b49 100644 --- a/lgsm/functions/query_gamedig.sh +++ b/lgsm/functions/query_gamedig.sh @@ -22,7 +22,6 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; gamedigcmd=$(echo -e "gamedig --type \"${querytype}\" --host \"${ip}\" --port \"${queryport}\"|jq") gamedigraw=$(gamedig --type "${querytype}" --host "${ip}" --port "${queryport}") querystatus=$(echo "${gamedigraw}" | jq '.error|length') - fi # server name. @@ -32,10 +31,14 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; fi # numplayers. - gdplayers=$(echo "${gamedigraw}" | jq -re '.raw.vanilla.raw.players.online') + if [ "${querytype}" == "minecraft" ]; then + gdplayers=$(echo "${gamedigraw}" | jq -re '.players | length-1') + else + gdplayers=$(echo "${gamedigraw}" | jq -re '.players | length') + fi if [ "${gdplayers}" == "null" ]; then unset gdplayers - elif [ "${gdplayers}" == "[]" ]; then + elif [ "${gdplayers}" == "[]" ] || [ "${gdplayers}" == "-1" ]; then gdplayers=0 fi @@ -60,7 +63,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; fi # numbots. - gdbots=$(echo "${gamedigraw}" | jq -re '.raw.numbots') + gdbots=$(echo "${gamedigraw}" | jq -re '.bots | length') if [ "${gdbots}" == "null" ]||[ "${gdbots}" == "0" ]; then unset gdbots fi