mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Update wl, bl, and op commands to not edit files
This commit updates the wl, bl, and op commands to no longer edit their corresponding server files. msm still edits config settings in files, but relies on minecraft server to manage it's own files, passing the commands to the running server for changes. Minecraft server moved to json in version 1.7.2 which made directly editing txt files no longer work. This change follows the pattern of the other passthrough commands that if the server isn't running, returns error_exit informing the user the server is not running. Fixes issue #404
This commit is contained in:
parent
4022d5a816
commit
fc954bc210
86
init/msm
86
init/msm
@ -2780,14 +2780,7 @@ command_server_whitelist_add() {
|
|||||||
echo_fallback "$RETURN" "Player $player is now whitelisted."
|
echo_fallback "$RETURN" "Player $player is now whitelisted."
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
server_property "$1" WHITELIST_PATH
|
error_exit SERVER_STOPPED "Server \"${SERVER_NAME[$1]}\" is not running."
|
||||||
|
|
||||||
for player in "${@:2}"; do
|
|
||||||
if ! grep "^$player\$" "${SERVER_WHITELIST_PATH[$1]}" >/dev/null; then
|
|
||||||
echo "$player" >> "${SERVER_WHITELIST_PATH[$1]}"
|
|
||||||
echo_fallback "$RETURN" "Player $player is now whitelisted."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2802,12 +2795,7 @@ command_server_whitelist_remove() {
|
|||||||
echo_fallback "$RETURN" "Player $player is no longer whitelisted."
|
echo_fallback "$RETURN" "Player $player is no longer whitelisted."
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
server_property "$1" WHITELIST_PATH
|
error_exit SERVER_STOPPED "Server \"${SERVER_NAME[$1]}\" is not running."
|
||||||
|
|
||||||
for player in "${@:2}"; do
|
|
||||||
sed -ri "/^$player\$/d" "${SERVER_WHITELIST_PATH[$1]}"
|
|
||||||
echo_fallback "$RETURN" "Player $player is no longer whitelisted."
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2839,14 +2827,7 @@ command_server_blacklist_player_add() {
|
|||||||
echo_fallback "$RETURN" "Player $player is now blacklisted."
|
echo_fallback "$RETURN" "Player $player is now blacklisted."
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
server_property "$1" BANNED_PLAYERS_PATH
|
error_exit SERVER_STOPPED "Server \"${SERVER_NAME[$1]}\" is not running."
|
||||||
|
|
||||||
for player in "${@:2}"; do
|
|
||||||
if ! grep "^$player\$" "${SERVER_BANNED_PLAYERS_PATH[$1]}" >/dev/null; then
|
|
||||||
echo "$player" >> "${SERVER_BANNED_PLAYERS_PATH[$1]}"
|
|
||||||
echo "Player $player is now blacklisted."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2860,12 +2841,7 @@ command_server_blacklist_player_remove() {
|
|||||||
echo_fallback "$RETURN" "Player $player is no longer blacklisted."
|
echo_fallback "$RETURN" "Player $player is no longer blacklisted."
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
server_property "$1" BANNED_PLAYERS_PATH
|
error_exit SERVER_STOPPED "Server \"${SERVER_NAME[$1]}\" is not running."
|
||||||
|
|
||||||
for player in "${@:2}"; do
|
|
||||||
sed -ri "/^$player\$/d" "${SERVER_BANNED_PLAYERS_PATH[$1]}"
|
|
||||||
echo "Player $player is no longer blacklisted."
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2879,14 +2855,7 @@ command_server_blacklist_ip_add() {
|
|||||||
echo_fallback "$RETURN" "IP address $address is now blacklisted."
|
echo_fallback "$RETURN" "IP address $address is now blacklisted."
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
server_property "$1" BANNED_IPS_PATH
|
error_exit SERVER_STOPPED "Server \"${SERVER_NAME[$1]}\" is not running."
|
||||||
|
|
||||||
for address in "${@:2}"; do
|
|
||||||
if ! grep "^$address\$" "${SERVER_BANNED_IPS_PATH[$1]}" >/dev/null; then
|
|
||||||
echo "$address" >> "${SERVER_BANNED_IPS_PATH[$1]}"
|
|
||||||
echo "IP address $address is now blacklisted."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2900,12 +2869,7 @@ command_server_blacklist_ip_remove() {
|
|||||||
echo_fallback "$RETURN" "IP address $address is no longer blacklisted."
|
echo_fallback "$RETURN" "IP address $address is no longer blacklisted."
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
server_property "$1" BANNED_PLAYERS_PATH
|
error_exit SERVER_STOPPED "Server \"${SERVER_NAME[$1]}\" is not running."
|
||||||
|
|
||||||
for address in "${@:2}"; do
|
|
||||||
sed -ri "/^$address\$/d" "${SERVER_BANNED_PLAYERS_PATH[$1]}"
|
|
||||||
echo "IP address $address is no longer blacklisted."
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2955,24 +2919,7 @@ command_server_operator_add() {
|
|||||||
echo_fallback "$RETURN" "Player $player is now an operator."
|
echo_fallback "$RETURN" "Player $player is now an operator."
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
server_property "$1" OPS_PATH
|
error_exit SERVER_STOPPED "Server \"${SERVER_NAME[$1]}\" is not running."
|
||||||
|
|
||||||
for player in "${@:2}"; do
|
|
||||||
if ! grep "^$player\$" "${SERVER_OPS_PATH[$1]}" >/dev/null; then
|
|
||||||
echo "$player" >> "${SERVER_OPS_PATH[$1]}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $# -gt 2 ]]; then
|
|
||||||
echo -n "The following players are now operators: "
|
|
||||||
echo -n "$2"
|
|
||||||
for player in "${@:3}"; do
|
|
||||||
echo -n ", $player"
|
|
||||||
done
|
|
||||||
echo "."
|
|
||||||
else
|
|
||||||
echo "\"$2\" is now an operator."
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2987,24 +2934,7 @@ command_server_operator_remove() {
|
|||||||
echo_fallback "$RETURN" "Player $player is no longer an operator."
|
echo_fallback "$RETURN" "Player $player is no longer an operator."
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
server_property "$1" OPS_PATH
|
error_exit SERVER_STOPPED "Server \"${SERVER_NAME[$1]}\" is not running."
|
||||||
|
|
||||||
for player in "${@:2}"; do
|
|
||||||
for player in "${@:2}"; do
|
|
||||||
sed -ri "/^$player\$/d" "${SERVER_OPS_PATH[$1]}"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $# -gt 2 ]]; then
|
|
||||||
echo -n "The following players are no longer operators: "
|
|
||||||
echo -n "$2"
|
|
||||||
for player in "${@:3}"; do
|
|
||||||
echo -n ", $player"
|
|
||||||
done
|
|
||||||
echo "."
|
|
||||||
else
|
|
||||||
echo "\"$2\" is no longer an operator."
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user