示例#1
0
        public Server()
        {
            if (theServ != null) return;
            theServ = this;

            salt = Spacecraft.random.Next(100000, 999999);

            IP = "";

            port = Config.GetInt("port", 25565);
            maxplayers = Config.GetInt("max-players", 16);
            name = Config.Get("server-name", "Minecraft Server");
            motd = Config.Get("motd", "Powered by " + Color.Green + "Spacecraft");

            Game = new GameBase();
        }
示例#2
0
        public static void Main(string[] args)
        {
            try {
                CalculateFilenames();

                Log("");
                Log("Spacecraft is starting...");
                if (!File.Exists("admins.txt")) {
                    Log("Note: admins.txt does not exist, creating a blank one. Be sure to add yourself!");
                    File.Create("admins.txt").Close();
                }

            #if WIN32
                cpuCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName);
                cpuCounter.NextValue();
            #endif

                // allow an explicit seed
                int seed = Config.GetInt("random-seed", -1);
                if (seed != -1) {
                    random = new Random(seed);
                } else {
                    random = new Random();
                }
                Player.LoadRanks();

                Server serv = new Server();

                serv.Start();

                Log("Bye!");
                Environment.Exit(0);
            }
            catch (Exception e) {
                // Something went wrong and wasn't caught
                Spacecraft.LogError("fatal uncaught exception", e);
            }
        }