Exemple #1
0
        public ServerNetworkManager(IPEndPoint endPoint, IServerPlatform platform)
        {
            endPoint.ThrownOnArgNull(nameof(endPoint));
            platform.ThrownOnArgNull(nameof(platform));

            ServerEndPoint = endPoint;

            ServerConfig              = platform.ServerConfig;
            Protocol                  = platform.Protocol;
            ServerListData            = new ServerListData(Protocol);
            ServerListData.ServerName = ServerConfig.ServerName;
            ServerListData.MaxPlayer  = ServerConfig.ServerMaxPlayer;

            RakDotNet.Utils.Logger.PrintCallBack = log => _logger.Debug(log.Message);

            _server = new MinecraftServer(endPoint);
            _server.ConnectPeerEvent    += Server_ConnectPeerEvent;
            _server.DisconnectPeerEvent += Server_DisconnectPeerEvent;
            UpdateServerList();
        }