Simplified connected players code.

Removed the ability to display a "No players are connected" message, as
support is currently not complete.
This commit is contained in:
Marcus Whybrow
2012-07-05 14:05:11 +01:00
parent 51222fbf26
commit d4892045d3

View File

@ -1030,15 +1030,14 @@ server_connected() {
if server_is_running "$1"; then if server_is_running "$1"; then
local line="$(server_eval_and_get_line "$1" "list" "Connected players:")" local line="$(server_eval_and_get_line "$1" "list" "Connected players:")"
# Cuts the start off the line, and the last three (invisible) # Cuts the start off the line
# characters from the end.
local players="${line:46}" local players="${line:46}"
if [ -z "$players" ]; then # TODO: Use a reliable method of detecting when no players are online,
echo "No players are connected." # and display a different message.
else # This is currently hard as invisible characters make string length
# always non-zero, and also may be ommitted.
echo "$players" echo "$players"
fi
else else
echo "Server \"${SERVER_NAME[$1]}\" is not running. No users are connected." echo "Server \"${SERVER_NAME[$1]}\" is not running. No users are connected."
fi fi