示例#1
0
        /// <summary>
        /// Inits this instance.
        /// </summary>
        public static void Init() {

            Running = true;

            Logger.WriteLog("--------- Server Started at " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " ---------");
            Logger.Log("Debug mode started", LogType.Debug);
            //TODO Add debug messages
            //TODO load the level if it exists
            Block.InIt();
            Logger.Log("Starting update timer", LogType.Debug);
            UpdateTimer = new System.Threading.Timer((e) => Update(), null, 0, 100);
            Logger.Log("Log timer started", LogType.Debug);
            Logger.Log("Loading DLL's", LogType.Debug);
            LoadAllDlls.Init();
            Logger.Log("Finished loading DLL's", LogType.Debug);
            Logger.Log("Sending Heartbeat..", LogType.Debug);
            Logger.Log("Auto-Updater Starting..", LogType.Debug);
            Updater.InIt();
            HeartThread = new Thread(new ThreadStart(Heartbeat.ActivateHeartBeat));
            HeartThread.Start();
            Logger.Log("Starting Physics Tick..", LogType.Debug);
            PhysicsBlock.InIt();
            CmdReloadCmds reload = new CmdReloadCmds();
            reload.Initialize();

            Groups.PlayerGroup.Load();
            VerifyGroup = Groups.PlayerGroup.Find(ServerSettings.GetSetting("VerifyGroup"));

            Mainlevel = Level.LoadLevel(ServerSettings.GetSetting("Main-Level"));
            if (Mainlevel == null) {
                Mainlevel = Level.CreateLevel(new Vector3S(256, 128, 64), Level.LevelTypes.Flat);
                ServerSettings.SetSetting("Main-Level", null, "main");
            }
            Level.Levels.Add(Mainlevel);
            if (ServerSettings.GetSettingBoolean("LoadAllLevels"))
                Level.LoadAllLevels();

            Backup.StartBackup();

            Database.init();

            CreateCoreFiles();

            InternetUtils = new InetUtils();
            InetUtils.InternetAvailable = InetUtils.CanConnectToInternet();

            Logger.Log("Loading Bans", LogType.Debug);
            Logger.Log("IPBANS", LogType.Debug);
            IPBans = new List<string>(File.ReadAllLines("bans/IPBans.txt"));
            Logger.Log("IPBANS", LogType.Debug);
            UsernameBans = new List<string>(File.ReadAllLines("bans/NameBans.txt"));
            StartListening();
            Started = true;

            if (OnServerFinishSetup != null)
                OnServerFinishSetup();

            Logger.Log("[Important]: Server Started.", Color.Black, Color.White);
            if (!ServerSettings.GetSettingBoolean("VerifyNames"))
                Logger.Log("[Important]: The server is running with verify names off! This could lead to bad things! Please turn on verify names if you dont know the risk and dont want these bad things to happen!", LogType.Critical);
            IRC = new IRC();
            try {
                IRC.Start();
            }
            catch { }
        }
示例#2
0
        public static void Init()
        {
            Logger.Log("Debug mode started", LogType.Debug);
            //TODO Add debug messages
            //TODO load the level if it exists
            Block.InIt();
            UpdateTimer = new System.Timers.Timer(100);
            UpdateTimer.Elapsed += delegate { Update(); };
            Logger.Log("Starting update timer", LogType.Debug);
            UpdateTimer.Start();
            Logger.Log("Log timer started", LogType.Debug);
            Logger.Log("Loading DLL's", LogType.Debug);
            LoadAllDlls.Init();
            Logger.Log("Finished loading DLL's", LogType.Debug);
            Logger.Log("Sending Heartbeat..", LogType.Debug);
            Heartbeat.sendHeartbeat();

            CmdReloadCmds reload = new CmdReloadCmds();
            reload.Initialize();

            Groups.PlayerGroup.Load();

            Database.init();

            CreateCoreFiles();

            Mainlevel = Level.LoadLevel(ServerSettings.GetSetting("Main-Level"));
            if (Mainlevel == null)
                Mainlevel = Level.CreateLevel(new Vector3S(256, 256, 64), Level.LevelTypes.Hell);

            Logger.Log("Loading Bans", LogType.Debug);
            Logger.Log("IPBANS", LogType.Debug);
            IPBans = new List<string>(File.ReadAllLines("bans/IPBans.txt"));
            Logger.Log("IPBANS", LogType.Debug);
            UsernameBans = new List<string>(File.ReadAllLines("bans/NameBans.txt"));
            StartListening();
            Started = true;
            Logger.Log("[Important]: Server Started.", Color.Black, Color.White);
            IRC = new IRC();
            try {
                IRC.Start();
            }
            catch { }
        }