Пример #1
0
 public MinecraftServer()
 {
     PacketHandlers = new Dictionary<Type, PacketHandler>();
     Handlers.PacketHandlers.RegisterHandlers(this);
     NetworkLock = new object();
     Clients = new List<RemoteClient>();
     Settings = ServerSettings.DefaultSettings;
     EntityManager = new EntityManager(this);
     LastTimeUpdate = DateTime.MinValue;
     NextChunkUpdate = DateTime.MinValue;
     PhysicsEngines = new List<PhysicsEngine>();
 }
Пример #2
0
        /// <summary>
        /// Creates a new Minecraft server to listen on the requested
        /// endpoint.
        /// </summary>
        public MinecraftServer(IPEndPoint endPoint)
        {
            Clients = new List<MinecraftClient>();
            MaxPlayers = 25;
            MotD = "Craft.Net Server";
            OnlineMode = EncryptionEnabled = true;
            Random = new Random();
            DefaultWorldIndex = 0;
            Levels = new List<Level>();
            LogProviders = new List<ILogProvider>();
            PluginChannels = new Dictionary<string, PluginChannel>();
            EntityManager = new EntityManager(this);
            Difficulty = Difficulty.Peaceful;

            socket = new Socket(AddressFamily.InterNetwork,
                                SocketType.Stream, ProtocolType.Tcp);
            socket.Bind(endPoint);
        }
Пример #3
0
 /// <summary>
 /// Creates a new Minecraft server to listen on the requested
 /// endpoint.
 /// </summary>
 public MinecraftServer(IPEndPoint endPoint, ServerSettings settings)
 {
     Settings = settings;
     // Initialize variables
     Clients = new List<MinecraftClient>();
     Levels = new List<Level>();
     LogProviders = new List<ILogProvider>();
     PluginChannels = new Dictionary<string, PluginChannel>();
     EntityManager = new EntityManager(this);
     WeatherManager = new WeatherManager(this);
     // Bind socket
     Listener = new TcpListener(endPoint);
     NetworkLock = new object();
 }
Пример #4
0
 /// <summary>
 /// Creates a new Minecraft server to listen on the requested
 /// endpoint.
 /// </summary>
 public MinecraftServer(IPEndPoint endPoint, ServerSettings settings)
 {
     Settings = settings;
     // Initialize variables
     Clients = new List<MinecraftClient>();
     Levels = new List<Level>();
     LogProviders = new List<ILogProvider>();
     PluginChannels = new Dictionary<string, PluginChannel>();
     EntityManager = new EntityManager(this);
     WeatherManager = new WeatherManager(this);
     // Bind socket
     Socket = new Socket(AddressFamily.InterNetwork,
                         SocketType.Stream, ProtocolType.Tcp);
     Socket.Bind(endPoint);
 }