Add a method to enable a world

This commit is contained in:
Jason M. Wood 2013-10-19 11:57:04 -06:00
parent 93911d6e7c
commit 4a18448ec9

View File

@ -420,6 +420,16 @@ disableWorld() {
execute "mv $WORLDS_LOCATION/$1 $DISABLED_WORLDS_LOCATION/$1" $USER_NAME execute "mv $WORLDS_LOCATION/$1 $DISABLED_WORLDS_LOCATION/$1" $USER_NAME
} }
# ---------------------------------------------------------------------------
# Enable a world.
#
# @param 1 The world server to enable.
# ---------------------------------------------------------------------------
enableWorld() {
# Enable the world.
execute "mv $DISABLED_WORLDS_LOCATION/$1 $WORLDS_LOCATION/$1" $USER_NAME
}
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Grab the first line of the Message of the Day file as a summary, and strip # Grab the first line of the Message of the Day file as a summary, and strip
# any color codes from it. # any color codes from it.
@ -1279,6 +1289,14 @@ case "$1" in
# Disable the world. # Disable the world.
disableWorld "$2" disableWorld "$2"
;; ;;
enable)
if [ ! -n "$2" ] || [ ! -f "$DISABLED_WORLDS_LOCATION/$2/server.properties" ]; then
printf "World not found, unable to enable world '$2'.\n"
exit 1
fi
# Enable the world.
enableWorld "$2"
;;
status|show) status|show)
# Figure out which worlds to show the status for. # Figure out which worlds to show the status for.
WORLDS=$(checkOptionalArgument "$ALL_WORLDS" $0 $1 $2) WORLDS=$(checkOptionalArgument "$ALL_WORLDS" $0 $1 $2)