コード例 #1
0
ファイル: Server.Init.cs プロジェクト: marvelgit/MCGalaxy
 static void InitTimers(SchedulerTask task)
 {
     MainScheduler.QueueRepeat(RandomMessage, null,
                               Server.Config.AnnouncementInterval);
     Critical.QueueRepeat(ServerTasks.UpdateEntityPositions, null,
                          TimeSpan.FromMilliseconds(Server.Config.PositionUpdateInterval));
 }
コード例 #2
0
ファイル: Server.Init.cs プロジェクト: ProtheanGod/KingMC
        static void InitTimers(SchedulerTask task)
        {
            TextFile announcementsFile = TextFile.Files["Announcements"];

            announcementsFile.EnsureExists();

            string[] lines = announcementsFile.GetText();
            messages = new List <string>(lines);

            MainScheduler.QueueRepeat(RandomMessage, null,
                                      TimeSpan.FromMinutes(5));
            Critical.QueueRepeat(ServerTasks.UpdateEntityPositions, null,
                                 TimeSpan.FromMilliseconds(ServerConfig.PositionUpdateInterval));
        }
コード例 #3
0
ファイル: Server.Init.cs プロジェクト: rdebath/MCGalaxy
        static void InitRest(SchedulerTask task)
        {
            CountdownGame.Instance.AutoStart();
            ZSGame.Instance.AutoStart();
            LSGame.Instance.AutoStart();
            CTFGame.Instance.AutoStart();
            TWGame.Instance.AutoStart();

            MainScheduler.QueueRepeat(BlockQueue.Loop, null,
                                      TimeSpan.FromMilliseconds(BlockQueue.Interval));
            Critical.QueueRepeat(ServerTasks.TickPlayers, null,
                                 TimeSpan.FromMilliseconds(20));

            Logger.Log(LogType.SystemActivity, "Finished setting up server");
            SetupFinished = true;
        }
コード例 #4
0
ファイル: Server.Init.cs プロジェクト: ProtheanGod/KingMC
        static void InitRest(SchedulerTask task)
        {
            IRC = new IRCBot();
            if (ServerConfig.UseIRC)
            {
                IRC.Connect();
            }

            InitZombieSurvival();
            InitLavaSurvival();
            MainScheduler.QueueRepeat(BlockQueue.Loop, null,
                                      TimeSpan.FromMilliseconds(BlockQueue.time));
            Critical.QueueRepeat(ServerTasks.LocationChecks, null,
                                 TimeSpan.FromMilliseconds(20));

            Logger.Log(LogType.SystemActivity, "Finished setting up server, finding classicube.net url..");
            ServerSetupFinished = true;
        }
コード例 #5
0
ファイル: Server.Init.cs プロジェクト: marvelgit/MCGalaxy
        static void InitRest(SchedulerTask task)
        {
            IRC = new IRCBot();
            IRC.LoadControllers();
            IRC.Connect();

            CountdownGame.Instance.AutoStart();
            ZSGame.Instance.AutoStart();
            LSGame.Instance.AutoStart();
            CTFGame.Instance.AutoStart();
            TWGame.Instance.AutoStart();

            MainScheduler.QueueRepeat(BlockQueue.Loop, null,
                                      TimeSpan.FromMilliseconds(BlockQueue.Interval));
            Critical.QueueRepeat(ServerTasks.TickPlayers, null,
                                 TimeSpan.FromMilliseconds(20));

            Logger.Log(LogType.SystemActivity, "Finished setting up server, finding classicube.net url..");
            SetupFinished = true;
        }
コード例 #6
0
        public void Start()
        {
            serverConfig = ConfigElement.GetAll(typeof(Server), typeof(ZombieGameProps));
            levelConfig  = ConfigElement.GetAll(typeof(Level));

            #pragma warning disable 0618
            Player.players       = PlayerInfo.Online.list;
            PlayerInfo.players   = PlayerInfo.Online.list;
            Server.levels        = LevelInfo.Loaded.list;
            PlayerBot.playerbots = PlayerBot.Bots.list;
            #pragma warning restore 0618

            StartTime      = DateTime.UtcNow;
            StartTimeLocal = StartTime.ToLocalTime();
            shuttingDown   = false;
            Log("Starting Server");
            try {
                if (File.Exists("Restarter.exe"))
                {
                    File.Delete("Restarter.exe");
                }
            } catch { }
            try {
                if (File.Exists("Restarter.pdb"))
                {
                    File.Delete("Restarter.pdb");
                }
            } catch { }

            CheckFile("MySql.Data.dll");
            CheckFile("System.Data.SQLite.dll");
            CheckFile("sqlite3.dll");
            CheckFile("Newtonsoft.Json.dll");
            CheckFile("LibNoise.dll");

            EnsureFilesExist();
            MoveOutdatedFiles();

            lava      = new LavaSurvival();
            zombie    = new ZombieGame();
            Countdown = new CountdownGame();
            LoadAllSettings();

            InitDatabase();
            Economy.LoadDatabase();
            Server.zombie.CheckTableExists();

            Level[] loaded = LevelInfo.Loaded.Items;
            foreach (Level l in loaded)
            {
                l.Unload();
            }

            Background.QueueOnce(UpgradeTasks.CombineEnvFiles);
            Background.QueueOnce(LoadMainLevel);
            Plugin.Load();
            Background.QueueOnce(UpgradeTasks.UpgradeOldBlacklist);
            Background.QueueOnce(LoadPlayerLists);
            Background.QueueOnce(LoadAutoloadCommands);
            Background.QueueOnce(UpgradeTasks.MovePreviousLevelFiles);
            Background.QueueOnce(UpgradeTasks.UpgradeOldLockdown);

            Background.QueueOnce(SetupSocket);
            Background.QueueOnce(InitTimers);
            Background.QueueOnce(InitRest);
            Background.QueueOnce(InitHeartbeat);

            Devs.Clear();
            Mods.Clear();
            Background.QueueOnce(InitTasks.UpdateStaffList);

            MainScheduler.QueueRepeat(ServerTasks.TemprankExpiry,
                                      null, TimeSpan.FromMinutes(1));
            Background.QueueRepeat(ServerTasks.AutoSave,
                                   1, TimeSpan.FromSeconds(Server.backupInterval));
            Background.QueueRepeat(ServerTasks.BlockUpdates,
                                   null, TimeSpan.FromSeconds(Server.blockInterval));
            Background.QueueRepeat(ThreadSafeCache.DBCache.CleanupTask,
                                   null, TimeSpan.FromMinutes(5));
        }