using Server.Accounting;
using Server.Commands.Generic;
using Server.Commands;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
using Server.Network;
using Server.Regions;
using Server;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System;

namespace Server.Scripts.Commands 
{
    public class BuildWorld
    {
        public static void Initialize()
        {
            CommandSystem.Register("BuildWorld", AccessLevel.Counselor, new CommandEventHandler( BuildWorlds ));
        }

        [Usage("BuildWorld")]
        [Description("This cleans up the world and rebuilds it, leaving players intact.")]
        public static void BuildWorlds( CommandEventArgs e )
        {
			Server.Commands.Decorate.Decorate_OnCommand( e );

			Server.SpawnGenerator.Parse( e.Mobile, "towns.map" );
			Server.SpawnGenerator.Parse( e.Mobile, "graveyards.map" );
			Server.SpawnGenerator.Parse( e.Mobile, "land.map" );
			Server.SpawnGenerator.Parse( e.Mobile, "dungeons.map" );
			Server.SpawnGenerator.Parse( e.Mobile, "labyrinths.map" );
			Server.SpawnGenerator.Parse( e.Mobile, "mazes.map" );
			if ( Server.Misc.Settings.PopulateTowns() ){ Server.SpawnGenerator.Parse( e.Mobile, "citizens.map" ); }

			Server.Regions.SpawnEntry.RespawnAllRegions_OnCommand( e );

			e.Mobile.SendMessage( "The world has been rebuilt." );
        }
    }
}