fCraft.WorldCommands.WorldUnlockHandler C# (CSharp) Method

WorldUnlockHandler() static private method

static private WorldUnlockHandler ( Player player, Command cmd ) : void
player Player
cmd Command
return void
        static void WorldUnlockHandler( Player player, Command cmd ) {
            string worldName = cmd.Next();

            World world;
            if( worldName != null ) {
                if( worldName == "*" ) {
                    World[] worldListCache = WorldManager.Worlds;
                    int unlocked = 0;
                    for( int i = 0; i < worldListCache.Length; i++ ) {
                        if( worldListCache[i].IsLocked ) {
                            worldListCache[i].Unlock( player );
                            unlocked++;
                        }
                    }
                    player.Message( "Unlocked {0} worlds.", unlocked );
                    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.Unlock( player ) ) {
                player.Message( "The world is already unlocked." );
            } else if( player.World != world ) {
                player.Message( "Unlocked world {0}", world );
            }
        }

Same methods

WorldCommands::WorldUnlockHandler ( Player player, CommandReader cmd ) : void
WorldCommands::WorldUnlockHandler ( [ player, [ cmd ) : void