コード例 #1
0
        void InitRest()
        {
            try {
                if (EnableHttpApi)
                {
                    APIServer = new WebServer(SendResponse, "http://localhost:8080/api/");
                    APIServer.Run();
                    InfoServer = new WebServer(WhoIsResponse, "http://localhost:8080/whois/");
                    InfoServer.Run();
                }
            } catch {
                Server.s.Log("Failed to start local API server");
            }

            IRC = new IRCBot();
            if (Server.irc)
            {
                IRC.Connect();
            }

            locationChecker      = new Thread(ServerTasks.LocationChecks);
            locationChecker.Name = "MCG_LocationCheck";
            locationChecker.Start();

            InitZombieSurvival();
            BlockQueue.Start();

            Log("Finished setting up server, finding classicube.net url..");
            ServerSetupFinished = true;
        }
コード例 #2
0
ファイル: Server.Tasks.cs プロジェクト: Peteys93/MCGalaxy
        void InitRest()
        {
            try {
                if (EnableHttpApi)
                {
                    APIServer = new WebServer(SendResponse, "http://localhost:8080/api/");
                    APIServer.Run();
                    InfoServer = new WebServer(WhoIsResponse, "http://localhost:8080/whois/");
                    InfoServer.Run();
                }
            } catch {
                Server.s.Log("Failed to start local API server");
            }

            IRC        = new ForgeBot(Server.ircChannel, Server.ircOpChannel, Server.ircNick, Server.ircServer);
            GlobalChat = new GlobalChatBot(GlobalChatNick());

            if (Server.irc)
            {
                IRC.Connect();
            }
            if (Server.UseGlobalChat)
            {
                GlobalChat.Connect();
            }

            new AutoSaver(Server.backupInterval);

            blockThread      = new Thread(DoBlockUpdates);
            blockThread.Name = "MCG_BlockUpdates";
            blockThread.Start();

            locationChecker      = new Thread(DoLocationChecks);
            locationChecker.Name = "MCG_LocationCheck";
            locationChecker.Start();
            #if DEBUG
            UseTextures = true;
            #endif
            Log("Finished setting up server, finding classicube.net url..");
            ServerSetupFinished = true;
            Checktimer.StartTimer();
            Commands.CommandKeywords.SetKeyWords();
            try
            {
                if (Server.lava.startOnStartup)
                {
                    Server.lava.Start();
                }
                if (ZombieGame.StartImmediately)
                {
                    Server.zombie.Start(ZombieGameStatus.InfiniteRounds, 0);
                }
                //This doesnt use the main map
                if (Server.UseCTF)
                {
                    ctf = new Auto_CTF();
                }
            }
            catch (Exception e) { Server.ErrorLog(e); }
            BlockQueue.Start();
        }