private void OnPlayerApproval(PlayerApprovalEvent e) { string ip = e.NetworkPlayerApproval.ipAddress; if (minutebans.ContainsKey(ip) || hourbans.ContainsKey(ip) || daybans.ContainsKey(ip)) { e.ClientConnection.DenyAccess(e.NetworkPlayerApproval, "tried to join but is banned", NetError.ApprovalDenied); } }
public void OnPlayerApproval(PlayerApprovalEvent e) { this.Invoke("On_PlayerApproval", new object[] { e }); }
public void OnPlayerApproval(PlayerApprovalEvent e) { Invoke("On_PlayerApproval", e); }
public static void PlayerApproval(ConnectionAcceptor ca, NetworkPlayerApproval approval) { if (ca.m_Connections.Count >= server.maxplayers) { approval.Deny(uLink.NetworkConnectionError.TooManyConnectedPlayers); } else { ClientConnection clientConnection = new ClientConnection(); if (!clientConnection.ReadConnectionData(approval.loginData)) { approval.Deny(uLink.NetworkConnectionError.IncorrectParameters); return; } Fougerite.Server srv = Fougerite.Server.GetServer(); ulong uid = clientConnection.UserID; string ip = approval.ipAddress; string name = clientConnection.UserName; if (clientConnection.Protocol != 1069) { Debug.Log((object)("Denying entry to client with invalid protocol version (" + ip + ")")); approval.Deny(uLink.NetworkConnectionError.IncompatibleVersions); } else if (BanList.Contains(uid)) { Debug.Log((object)("Rejecting client (" + uid.ToString() + "in banlist)")); approval.Deny(uLink.NetworkConnectionError.ConnectionBanned); } else if (srv.IsBannedID(uid.ToString()) || srv.IsBannedIP(ip)) { if (!srv.IsBannedIP(ip)) { srv.BanPlayerIP(ip, name + "-Console"); Logger.LogDebug("[FougeriteBan] Detected banned ID, but IP is not banned: " + name + " - " + ip + " - " + uid); } if (!srv.IsBannedID(uid.ToString())) { srv.BanPlayerID(uid.ToString(), name + "-Console"); Logger.LogDebug("[FougeriteBan] Detected banned IP, but ID is not banned: " + name + " - " + ip + " - " + uid); } Debug.Log("[FougeriteBan] Disconnected: " + name + " - " + ip + " - " + uid, null); Logger.LogDebug("[FougeriteBan] Disconnected: " + name + " - " + ip + " - " + uid); approval.Deny(uLink.NetworkConnectionError.ConnectionBanned); } else if (ca.IsConnected(clientConnection.UserID)) { PlayerApprovalEvent ape = new PlayerApprovalEvent(ca, approval, clientConnection, true); if (OnPlayerApproval != null) { OnPlayerApproval(ape); } if (ape.ForceAccept && !ape.ServerHasPlayer) { Accept(ca, approval, clientConnection); return; } Debug.Log((object)("Denying entry to " + uid.ToString() + " because they're already connected")); approval.Deny(uLink.NetworkConnectionError.AlreadyConnectedToAnotherServer); } else { PlayerApprovalEvent ape = new PlayerApprovalEvent(ca, approval, clientConnection, false); if (OnPlayerApproval != null) { OnPlayerApproval(ape); } Accept(ca, approval, clientConnection); } } }