Fix a couple of potential issues with player count checking

This commit is contained in:
Ben Peddell 2016-03-09 19:32:01 +10:00
parent fd26375770
commit 63ded49b30

View File

@ -949,7 +949,7 @@ doWarn(){
doBroadcastWithEcho "$warnmsg"
for (( min = warnminutes - 1; min >= warninterval; min-- )); do
numplayers=$(numPlayersConnected)
if (( numplayers + 0 == 0 )); then
if (( (numplayers + 0) == 0 )); then
echo "Nobody is connected. Shutting down immediately"
return 0
fi
@ -976,7 +976,7 @@ doWarn(){
doBroadcastWithEcho "$warnmsg"
if (( warnseconds >= 20 )); then
numplayers=$(numPlayersConnected)
if (( numplayers + 0 == 0 )); then
if (( (numplayers + 0) == 0 )); then
echo "Nobody is connected. Shutting down immediately"
return 0
fi
@ -1114,7 +1114,7 @@ doUpdate() {
fi
elif [ "$updatetype" == "ifempty" ]; then
numplayers=$(( $(numPlayersConnected) + 0 ))
if (( numplayers == 0 )); then
if (( numplayers != 0 )); then
echo "${numplayers} players are still connected"
return 1
fi