Start() public method

public Start ( ) : void
return void
Exemplo n.º 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();
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            CheckEnviornment();
            // TODO: Load plugins
            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();
                    (SettingsProvider as VanillaSettingsProvider).Load(
                        File.Open("server.properties", FileMode.Open));
                }
                else
                {
                    // TODO: Create a better settings provider than vanilla
                    SettingsProvider = new VanillaSettingsProvider();
                    SetUpDefaultPermissions(SettingsProvider);
                }
            }

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

            server.Start();

            Console.WriteLine("Press 'q' to quit.");
            while (true)
            {
                var key = Console.ReadKey(true);
                if (key.KeyChar == 'q')
                    break;
            }

            server.Stop();
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            if (PreStartup != null)
                PreStartup(null, null);
            if (SettingsProvider == null)
                SettingsProvider = new VanillaSettingsProvider();

            Server server = new Server(SettingsProvider);
            // TODO: Better logging
            ConsoleLogWriter consoleLog = new ConsoleLogWriter(LogImportance.High);
            server.MinecraftServer.AddLogProvider(consoleLog);

            server.Start();

            while (true)
            {
                var key = Console.ReadKey(true);
                if (key.KeyChar == 'q')
                    break;
            }

            server.Stop();
        }