mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Fixes #20. By implementing checks before reading server files.
This commit is contained in:
parent
996e67b340
commit
9b8a1dd21d
17
init/msm
17
init/msm
@ -1564,7 +1564,7 @@ command_server_whitelist_remove() {
|
||||
# Displays a list of whitelisted players for an individual server
|
||||
# $1: The server ID
|
||||
command_server_whitelist_list() {
|
||||
# TODO: Protect against no whitelist file
|
||||
if [ -f "${server_whitelist[$1]}" ]; then
|
||||
local players="$(cat "${server_whitelist[$1]}")"
|
||||
|
||||
if [ -z "$players" ]; then
|
||||
@ -1572,6 +1572,9 @@ command_server_whitelist_list() {
|
||||
else
|
||||
echo "$players"
|
||||
fi
|
||||
else
|
||||
echo "No players are whitelisted."
|
||||
fi
|
||||
}
|
||||
|
||||
# Adds player names to a server's ban list
|
||||
@ -1657,10 +1660,16 @@ command_server_blacklist_ip_remove() {
|
||||
# Displays a server's banned player names and ip addresses
|
||||
# $1: The server ID
|
||||
command_server_blacklist_list() {
|
||||
# TODO: Protect against non-existent files
|
||||
local players
|
||||
local ips
|
||||
|
||||
local players="$(cat "${server_banned_players[$1]}")"
|
||||
local ips="$(cat "${server_banned_ips[$1]}")"
|
||||
if [ -f "${server_banned_players[$1]}" ]; then
|
||||
players="$(cat "${server_banned_players[$1]}")"
|
||||
fi
|
||||
|
||||
if [ -f "${server_banned_ips[$1]}" ]; then
|
||||
ips="$(cat "${server_banned_ips[$1]}")"
|
||||
fi
|
||||
|
||||
if [[ -z "$players" && -z "$ips" ]]; then
|
||||
echo "The blacklist is empty."
|
||||
|
Loading…
Reference in New Issue
Block a user