mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Merge remote-tracking branch 'cameroncros/master'
Conflicts: init/msm
This commit is contained in:
commit
10c994fc59
@ -118,7 +118,7 @@ _msm() {
|
||||
__init_server "${COMP_WORDS[1]}"
|
||||
|
||||
if [[ $COMP_CWORD == 2 ]]; then
|
||||
options="start stop restart status connected worlds logroll backup jar whitelist blacklist operator gamemode kick say time toggledownfall give xp save cmd cmdlog console"
|
||||
options="start stop restart status connected worlds logroll backup jar whitelist blacklist operator gamemode kick say time toggledownfall give xp save cmd cmdlog console config"
|
||||
else
|
||||
case "${COMP_WORDS[2]}" in
|
||||
stop|restart)
|
||||
@ -247,6 +247,11 @@ _msm() {
|
||||
options="on off all"
|
||||
fi
|
||||
;;
|
||||
config)
|
||||
if [[ $COMP_CWORD == 3 ]]; then
|
||||
options="$(more $SERVER_CONF | sed 's/=.*$//' | grep -v '#')";
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
@ -259,4 +264,4 @@ _msm() {
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _msm msm
|
||||
complete -F _msm msm
|
||||
|
21
init/msm
21
init/msm
@ -1981,6 +1981,25 @@ command_server_console() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Sets a parameter in the config file if it exists, otherwise inserts the
|
||||
# paramerter.
|
||||
# $1: The server ID
|
||||
# $2: The parameter
|
||||
# $3: The value to set it to
|
||||
command_set_config() {
|
||||
if server_is_running "$1"; then
|
||||
echo "Server is running, please stop the server before running this command: sudo msm "${SERVER_NAME[$1]}" stop"
|
||||
else
|
||||
if [[ -f "${SERVER_CONF[$1]}" ]]; then
|
||||
if grep "$2" ${SERVER_CONF[$1]} >/dev/null; then
|
||||
sed -i /$2=/s/.*/"$2=$3"/g ${SERVER_CONF[$1]}
|
||||
else
|
||||
echo "$2=$3" >> ${SERVER_CONF[$1]}
|
||||
fi
|
||||
echo "To see these changes please restart this server with: sudo msm "${SERVER_NAME[$1]}" start";
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
### Main Functions
|
||||
|
||||
@ -2752,7 +2771,7 @@ main() {
|
||||
register_command "<name:server> cmd <strings>" "command_server_cmd"
|
||||
register_command "<name:server> cmdlog <strings>" "command_server_cmdlog"
|
||||
register_command "<name:server> console" "command_server_console"
|
||||
|
||||
register_command "<name:server> config <string> <string>" "command_set_config"
|
||||
# This function call matches the user input to a registered command
|
||||
# signature, and then calls that commands handler function with positional
|
||||
# arguments containing any variable strings.
|
||||
|
4
msm.conf
4
msm.conf
@ -21,6 +21,7 @@ USERNAME="minecraft"
|
||||
|
||||
# Where new servers are stored
|
||||
SERVER_STORAGE_PATH="/opt/msm/servers"
|
||||
DEFAULT_SERVER_CONF="server.properties"
|
||||
|
||||
# Where runnable jar files for use by servers are stored
|
||||
JAR_STORAGE_PATH="/opt/msm/jars"
|
||||
@ -220,4 +221,5 @@ DEFAULT_CONFIRM_XP="CONSOLE: Giving .+ exp to .+"
|
||||
DEFAULT_CONFIRM_XP_FAIL_NO_USER="Can't find user .+"
|
||||
|
||||
# The message logged when the experience amount given is an invalid format
|
||||
DEFAULT_CONFIRM_XP_FAIL_INVALID_AMOUNT="Invalid exp count: .+"
|
||||
DEFAULT_CONFIRM_XP_FAIL_INVALID_AMOUNT="Invalid exp count: .+"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user