fCraft.ZoneCommands.ZoneListHandler C# (CSharp) Method

ZoneListHandler() private static method

private static ZoneListHandler ( Player player, Command cmd ) : void
player Player
cmd Command
return void
        private static void ZoneListHandler( Player player, Command cmd )
        {
            World world = player.World;
            string worldName = cmd.Next();
            if ( worldName != null ) {
                world = WorldManager.FindWorldOrPrintMatches( player, worldName );
                if ( world == null )
                    return;
                player.Message( "List of zones on {0}&S:",
                                world.ClassyName );
            } else if ( world != null ) {
                player.Message( "List of zones on this world:" );
            } else {
                player.Message( "When used from console, &H/Zones&S command requires a world name." );
                return;
            }

            Map map = world.Map;
            if ( map == null ) {
                if ( !MapUtility.TryLoadHeader( world.MapFileName, out map ) ) {
                    player.Message( "&WERROR:Could not load mapfile for world {0}.",
                                    world.ClassyName );
                    return;
                }
            }

            Zone[] zones = map.Zones.Cache;
            if ( zones.Length > 0 ) {
                foreach ( Zone zone in zones ) {
                    player.Message( "   {0} ({1}&S) - {2} x {3} x {4}",
                                    zone.Name,
                                    zone.Controller.MinRank.ClassyName,
                                    zone.Bounds.Width,
                                    zone.Bounds.Length,
                                    zone.Bounds.Height );
                }
                player.Message( "   Type &H/ZInfo ZoneName&S for details." );
            } else {
                player.Message( "   No zones defined." );
            }
        }