From ba8a8f14cd3d5275c37e37873b81e727925f1e3a Mon Sep 17 00:00:00 2001 From: Marcus Whybrow Date: Wed, 30 May 2012 16:28:29 +0100 Subject: [PATCH] Added server "toggledownfall" command. Closes #6. --- msm | 20 +++++++++++++++++++- msm.conf | 9 ++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/msm b/msm index 7c03084..5dd2abd 100755 --- a/msm +++ b/msm @@ -1132,6 +1132,8 @@ init() { server_confirm_time_set_fail[$i]="$DEFAULT_CONFIRM_TIME_SET_FAIL" server_confirm_time_add[$i]="$DEFAULT_CONFIRM_TIME_ADD" server_confirm_time_add_fail[$i]="$DEFAULT_CONFIRM_TIME_ADD_FAIL" + server_confirm_toggledownfall[$i]="$DEFAULT_CONFIRM_TOGGLEDOWNFALL" + server_confirm_toggledownfall_fail[$i]="$DEFAULT_CONFIRM_TOGGLEDOWNFALL_FAIL" server_complete_backup_follow_symlinks[$i]="$DEFAULT_COMPLETE_BACKUP_FOLLOW_SYMLINKS" @@ -1180,6 +1182,8 @@ init() { CONFIRM_TIME_SET_FAIL) server_confirm_time_set_fail[$i]="$value";; CONFIRM_TIME_ADD) server_confirm_time_add[$i]="$value";; CONFIRM_TIME_ADD_FAIL) server_confirm_time_add_fail[$i]="$value";; + CONFIRM_TOGGLEDOWNFALL) server_confirm_toggledownfall[$i]="$value";; + CONFIRM_TOGGLEDOWNFALL_FAIL) server_confirm_toggledownfall_fail[$i]="$value";; COMPLETE_BACKUP_FOLLOW_SYMLINKS) server_complete_backup_follow_symlinks[$i]="$value";; esac done < "${server_conf[$i]}" @@ -1691,7 +1695,21 @@ main() { ;; esac ;; - toggledownfall) + toggledownfall|tdf) + if server_is_running $id; then + local line=$(server_eval_and_get_line $id "toggledownfall $3" "${server_confirm_toggledownfall[$id]}" "${server_confirm_toggledownfall_fail[$id]}") + + local regex="${LOG_REGEX} ${server_confirm_toggledownfall[$id]}" + if [[ "$line" =~ $regex ]]; then + echo ${line:36:(-3)} + fi + local regex="${LOG_REGEX} ${server_confirm_toggledownfall_fail[$id]}" + if [[ "$line" =~ $regex ]]; then + echo ${line:34:(-3)} + fi + else + echo "Server \"${server_name[$id]}\" is not running." + fi ;; save) ;; diff --git a/msm.conf b/msm.conf index 1569106..dbdd45f 100644 --- a/msm.conf +++ b/msm.conf @@ -172,4 +172,11 @@ DEFAULT_CONFIRM_TIME_SET_FAIL="Unable to convert time value" DEFAULT_CONFIRM_TIME_ADD="CONSOLE: Added .+ to time" # The start of the message logged when the server time cannot be set -DEFAULT_CONFIRM_TIME_ADD_FAIL="Unable to convert time value" \ No newline at end of file +DEFAULT_CONFIRM_TIME_ADD_FAIL="Unable to convert time value" + +# The start of the message logged when downfall is toggled +DEFAULT_CONFIRM_TOGGLEDOWNFALL="CONSOLE: Toggling downfall on|off for world" + +# The start of the message logged when the togglefownfall command is given a +# world name that does not exist +DEFAULT_CONFIRM_TOGGLEDOWNFALL_FAIL="\[31m;1mNo world exists with the name"