Inheritance: Craft.Net.Server.RemoteClient
示例#1
0
        public static void Main(string[] args)
        {
            CheckEnvironment();
            // TODO: Load certain plugins earlier
            if (PreStartup != null)
            {
                PreStartup(null, null);
            }
            if (SettingsProvider == null)
            {
                // Select a settings provider based on the enviornment
                if (File.Exists("server.properties"))
                {
                    SettingsProvider = new VanillaSettingsProvider("server.properties");
                }
                else
                {
                    // TODO: Create a better settings provider than vanilla
                    SettingsProvider = new VanillaSettingsProvider("server.properties");
                    SetUpDefaultPermissions(SettingsProvider);
                }
            }

            var server = new Server(SettingsProvider);

            LoadPlugins(server);
            Command.LoadCommands(server);
            // TODO
            //var consoleLog = new ConsoleLogWriter(LogImportance.Medium);
            //LogProvider.RegisterProvider(consoleLog);

            server.Start();

            Console.WriteLine("Use /stop to kill the server.");
            ConsoleClient = new ConsoleClient(server.MinecraftServer);
            while (true)
            {
                var command = Console.ReadLine();
                try
                {
                    if (!String.IsNullOrWhiteSpace(command))
                    {
                        Command.ExecuteCommand(server, ConsoleClient, command);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
            }

            server.Stop();
        }
示例#2
0
        public static void Main(string[] args)
        {
            CheckEnvironment();
            // TODO: Load certain plugins earlier
            if (PreStartup != null)
                PreStartup(null, null);
            if (SettingsProvider == null)
            {
                // Select a settings provider based on the enviornment
                if (File.Exists("server.properties"))
                    SettingsProvider = new VanillaSettingsProvider("server.properties");
                else
                {
                    // TODO: Create a better settings provider than vanilla
                    SettingsProvider = new VanillaSettingsProvider("server.properties");
                    SetUpDefaultPermissions(SettingsProvider);
                }
            }

            var server = new Server(SettingsProvider);
            LoadPlugins(server);
            Command.LoadCommands(server);
            // TODO
            //var consoleLog = new ConsoleLogWriter(LogImportance.Medium);
            //LogProvider.RegisterProvider(consoleLog);

            server.Start();

            Console.WriteLine("Use /stop to kill the server.");
            ConsoleClient = new ConsoleClient(server.MinecraftServer);
            while (true)
            {
                var command = Console.ReadLine();
                try
                {
                    if (!String.IsNullOrWhiteSpace(command))
                        Command.ExecuteCommand(server, ConsoleClient, command);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
            }

            server.Stop();
        }