mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Implemented "server connected" command.
This commit is contained in:
parent
62aea7e759
commit
3807552b55
21
msm
21
msm
@ -862,6 +862,26 @@ server_backup() {
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
# Lists the players currently connected to a server
|
||||
# $1: The ID of the server
|
||||
server_connected() {
|
||||
if server_is_running $1; then
|
||||
local line=$(server_eval_and_get_line $1 "list" "Connected players:")
|
||||
|
||||
# Cuts the start off the line, and the last three (invisible)
|
||||
# characters from the end.
|
||||
local players=${line:46:(-3)}
|
||||
|
||||
if [ -z "$players" ]; then
|
||||
echo "No players are connected."
|
||||
else
|
||||
echo "$players"
|
||||
fi
|
||||
else
|
||||
echo "Server \"${server_name[$id]}\" is stopped. No users are connected."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
### Main Functions
|
||||
|
||||
@ -1297,6 +1317,7 @@ main() {
|
||||
fi
|
||||
;;
|
||||
connected)
|
||||
server_connected $1
|
||||
;;
|
||||
worlds)
|
||||
case "$3" in
|
||||
|
Loading…
Reference in New Issue
Block a user