GetUserNameFromConnection() public static method

public static GetUserNameFromConnection ( BoltConnection connection ) : string
connection BoltConnection
return string
Beispiel #1
0
 public override void Disconnected(BoltConnection connection)
 {
     lobby.RemovePlayer(PlayerRegistry.GetUserNameFromConnection(connection));
     PlayerRegistry.Remove(connection);
 }
Beispiel #2
0
 public override void OnEvent(TeamChangeEvent evnt)
 {
     lobby.SetPlayerTeam(PlayerRegistry.GetUserNameFromConnection(evnt.RaisedBy), evnt.NewTeam);
 }
Beispiel #3
0
    private void KickAllNonCompliantPlayers()
    {
        //linq!
        // select all connections whose associated username is not contained within the list of all usernames in the controlledPlayers list
        var playersToKick = PlayerRegistry.Connections.Where(c => !controlledPlayers.Select(x => x.Username).Contains(PlayerRegistry.GetUserNameFromConnection(c)));

        //playersToKick contains all players who are not in the controlledPlayers list
        foreach (BoltConnection c in playersToKick)
        {
            c.Disconnect(new DisconnectReason("AntiCheat Violation", "Did not surrender control to server in time"));
        }
    }