diff --git a/msm b/msm index 865d794..c6be472 100755 --- a/msm +++ b/msm @@ -86,9 +86,16 @@ get_latest_file() { } -### Manager Functions +### Server Functions -manager_create_server() { +server_list() { + echo "Servers:" + for server in "$SERVER_STORAGE_PATH/*"; do + echo " $(basename $server)" + done +} + +server_create() { if is_valid_name "$1"; then if [[ -e "$SERVER_STORAGE_PATH/$1" ]]; then echo "A server with that name already exists." @@ -106,7 +113,7 @@ manager_create_server() { fi } -manager_delete_server() { +server_delete() { if is_valid_name "$1" && [[ -e "$SERVER_STORAGE_PATH/$1" ]]; then printf "Are you sure you want to delete this server and its worlds (note: backups are preserved) [y/N]: " @@ -126,7 +133,7 @@ manager_delete_server() { fi } -manager_rename_server() { +server_rename() { if is_valid_name "$1" && [[ -e "$SERVER_STORAGE_PATH/$1" ]]; then # If the server name is valid, # and there is no other server with the name $1 @@ -152,6 +159,9 @@ manager_rename_server() { fi } + +### Jar Group Functions + jargroup_create() { if is_valid_name "$1"; then if [[ -e "$JAR_STORAGE_PATH/$1" ]]; then @@ -283,6 +293,7 @@ case "$1" in server) case "$2" in list) + server_list ;; create) if [ -z "$3" ]; then @@ -290,7 +301,7 @@ case "$1" in echo "Invalid command." else # Create a new server - manager_create_server "$3" + server_create "$3" fi ;; delete) @@ -299,7 +310,7 @@ case "$1" in echo "Invalid command." else # Delete an existing server, with confirmation - manager_delete_server "$3" + server_delete "$3" fi ;; rename) @@ -308,7 +319,7 @@ case "$1" in echo "Invalid command." else # Rename an existing server - manager_rename_server "$3" "$4" + server_rename "$3" "$4" fi ;; *)