public void DenyEnter(ref MyEventEnterGame msg)
 {
     var response = new MyEventEnterGameResponse();
     response.Allowed = false;
     Peers.NetworkClient.Send(ref response, msg.SenderConnection, NetDeliveryMethod.ReliableOrdered, 0);
 }
        public void AllowEnter(ref MyEventEnterGame msg)
        {
            var playerList = msg.ConnectedPlayers;
            bool allConnected = MyMultiplayerPeers.Static.Players.All(s => playerList.Contains(s.UserId));
            if (allConnected)
            {
                // Generate game user id and send back
                var response = new MyEventEnterGameResponse();
                response.Allowed = true;
                response.PlayerId = GeneratePlayerId();

                var newPlayer = new MyPlayerRemote(new StringBuilder(msg.PlayerInfo.DisplayName), msg.PlayerInfo.UserId, response.PlayerId);
                newPlayer.Connection = msg.SenderConnection;
                msg.SenderConnection.Tag = newPlayer;
                newPlayer.Faction = MyMwcObjectBuilder_FactionEnum.None;

                MyMultiplayerPeers.Static.Players.Add(newPlayer);

                Peers.NetworkClient.Send(ref response, msg.SenderConnection, NetDeliveryMethod.ReliableOrdered, 0);
            }
            else
            {
                SendPlayerList(msg.SenderConnection);
            }
        }
        // Client is joining to ME and I'm host
        private void OnEnterGame(ref MyEventEnterGame msg)
        {
            Log("OnEnterGame");

            if (JoinMode == MyJoinMode.Open)
            {
                AllowEnter(ref msg);
            }
            else if (JoinMode == MyJoinMode.Closed)
            {
                DenyEnter(ref msg);
            }

        }