static void WorldUnloadHandler( Player player, Command cmd ) {
string worldName = cmd.Next();
if( worldName == null ) {
CdWorldUnload.PrintUsage( player );
return;
}
World world = WorldManager.FindWorldOrPrintMatches( player, worldName );
if( world == null ) return;
try {
WorldManager.RemoveWorld( world );
} catch( WorldOpException ex ) {
switch( ex.ErrorCode ) {
case WorldOpExceptionCode.CannotDoThatToMainWorld:
player.MessageNow( "&WWorld {0}&W is set as the main world. " +
"Assign a new main world before deleting this one.",
world.ClassyName );
return;
case WorldOpExceptionCode.WorldNotFound:
player.MessageNow( "&WWorld {0}&W is already unloaded.",
world.ClassyName );
return;
default:
player.MessageNow( "&WUnexpected error occured while unloading world {0}&W: {1}",
world.ClassyName, ex.GetType().Name );
Logger.Log( LogType.Error,
"WorldCommands.WorldUnload: Unexpected error while unloading world {0}: {1}",
world.Name, ex );
return;
}
}
WorldManager.SaveWorldList();
Server.Message( player,
"{0}&S removed {1}&S from the world list.",
player.ClassyName, world.ClassyName );
player.Message( "Removed {0}&S from the world list. You can now delete the map file ({1}.fcm) manually.",
world.ClassyName, world.Name );
Logger.Log( LogType.UserActivity,
"{0} removed \"{1}\" from the world list.",
player.Name, worldName );
Server.RequestGC();
}