static void WorldLockHandler( Player player, Command cmd ) {
string worldName = cmd.Next();
World world;
if( worldName != null ) {
if( worldName == "*" ) {
int locked = 0;
World[] worldListCache = WorldManager.Worlds;
for( int i = 0; i < worldListCache.Length; i++ ) {
if( !worldListCache[i].IsLocked ) {
worldListCache[i].Lock( player );
locked++;
}
}
player.Message( "Unlocked {0} worlds.", locked );
return;
} else {
world = WorldManager.FindWorldOrPrintMatches( player, worldName );
if( world == null ) return;
}
} else if( player.World != null ) {
world = player.World;
} else {
player.Message( "When called from console, /WLock requires a world name." );
return;
}
if( !world.Lock( player ) ) {
player.Message( "The world is already locked." );
} else if( player.World != world ) {
player.Message( "Locked world {0}", world );
}
}