Closed Roflicide closed 4 years ago
Having the force-*
variants skip this check might be a good idea.
Having the
force-*
variants skip this check might be a good idea.
oh, good point. i totally forgot about those commands
I don't think there is a force-start though
I like this, good idea.
Nice. Thanks @Roflicide. I'll accept the PR.
Woops -- I accidently had in code there that i was gonna put in another PR that warns the user before checking to delete a world (bold is what I added to the delete command)
do you want me revert this back?
delete | remove)
# Get list of enabled worlds.
if ! isWorldAvailable "$1"; then
printf "World not found, unable to delete world '$1'.\n"
exit 1
fi
**printf "Are you sure you wish to delete world '$1'? (y/n): "
read answer
if [ "$answer" = "${answer#[Yy]}" ]; then
printf "Aborted.\n"
exit 1
else**
printf "Deleting Minecraft world: $1"
if serverRunning "$1"; then
# If the world server has users logged in, announce that the world is
# being deleted.
if [ $(queryNumUsers "$1") -gt 0 ]; then
sendCommand "$1" "say The server admin is deleting this world."
sendCommand "$1" "say The server will be deleted in 1 minute..."
sleep 60
sendCommand "$1" "say The server is now shutting down."
fi
# Stop the world server.
stop "$1"
sleep 5
fi
# Delete the world.
deleteWorld "$1"
printf ".\n"
fi
That is a good idea. Don't worry about it being in this PR
Attempting to start an already started world or stop an already stopped world will only display a period ("."), such as below:
This patch notifies the user when they attempt to start or stop an already started/stopped world. If the user tries to start/stop multiple worlds and one already is started/stopped, then the entire command will exit and no worlds will be started or stopped (same behavior when user tries to start/stop/restart worlds and one world doesn't exist).
Additionally, right now when a user tries to start/stop/restart a world that doesn't exist, it will say "World not recognized . I changed the warnings to "World not recognized or disabled" since disabled worlds won't be recognized either (since the worlds are being checked with the
isWorldEnabled
function).