コード例 #1
0
ファイル: Server.cs プロジェクト: hirsty/MCForge-Vanilla-1
        internal static void Init()
        {
            StartListening();

            Mainlevel = Level.CreateLevel(new Point3(256, 256, 64), Level.LevelTypes.Flat);

            UpdateTimer = new System.Timers.Timer(100);
            UpdateTimer.Elapsed += delegate { Update(); };
            UpdateTimer.Start();

            HeartbeatTimer = new System.Timers.Timer(30000); //every 30 seconds
            HeartbeatTimer.Elapsed += delegate { Heartbeat.sendHeartbeat(); };
            HeartbeatTimer.Start();

            LoadAllDlls.Init();

            Log("[Important]: Server Started.", ConsoleColor.Black, ConsoleColor.White);
            Started = true;

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

            //Create the directories we need...
            if (!Directory.Exists("text")) { Directory.CreateDirectory("text"); Log("Created text directory...", ConsoleColor.White, ConsoleColor.Black); }
            if (!File.Exists("text/agreed.txt")) { File.Create("text/agreed.txt").Close(); Log("[File] Created agreed.txt", ConsoleColor.White, ConsoleColor.Black); }
            if (!File.Exists("text/jokermessages.txt"))
            {
                File.Create("text/jokermessages.txt").Close();
                Log("[File] Created jokermessages.txt", ConsoleColor.White, ConsoleColor.Black);
                string text = "I am a pony" + Environment.NewLine + "Rainbow Dash <3" + Environment.NewLine + "I like trains!";
                File.WriteAllText("text/jokermessages.txt", text);
                Log("[File] Added default messages to jokermessages.txt", ConsoleColor.White, ConsoleColor.Black);
            }
            try
            {
                string[] lines = File.ReadAllLines("text/agreed.txt");
                foreach (string pl in lines) { agreed.Add(pl); }
            }
            catch { Log("[Error] Error reading agreed players!", ConsoleColor.Red, ConsoleColor.Black); }
        }
コード例 #2
0
ファイル: Server.cs プロジェクト: ddeckys/MCForge-Vanilla
        internal static void Init()
        {
            StartListening();

            Mainlevel = Level.CreateLevel(new Point3(256, 256, 64), Level.LevelTypes.Flat);

            UpdateTimer = new System.Timers.Timer(100);
            UpdateTimer.Elapsed += delegate { Update(); };
            UpdateTimer.Start();

            LoadAllDlls.Init();

            Log("[Important]: Server Started.", ConsoleColor.Black, ConsoleColor.White);
            Started = true;

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

            //Create the directories we need...
            if (!Directory.Exists("text")) { Directory.CreateDirectory("text"); Log("Created text directory...", ConsoleColor.White, ConsoleColor.Black); }
            if (!File.Exists("text/agreed.txt")) { File.Create("text/agreed.txt").Close(); Log("Created agreed.txt", ConsoleColor.White, ConsoleColor.Black); }

            try
            {
                string[] lines = File.ReadAllLines("text/agreed.txt");
                foreach (string pl in lines) { agreed.Add(pl); }
            }
            catch { Log("[Error] Error reading agreed players!", ConsoleColor.Red, ConsoleColor.Black); }
        }