Beispiel #1
0
        private void InvokeUserKickEvent(User kickedBy, User kickedUser, string reason)
        {
            var eventArgs = new KickedUserEventArgs
            {
                KickedBy   = kickedBy,
                KickedUser = kickedUser,
                Reason     = reason
            };

            UserKick?.Invoke(this, eventArgs);
        }
Beispiel #2
0
        private void OnUserKick(object sender, KickedUserEventArgs e)
        {
            var kickedUser = Users.Find(user => user.Id == e.KickedUser.Id);

            if (kickedUser == null)
            {
                return;
            }

            var kickedBy = Users.Find(user => user.Id == e.KickedBy.Id);

            if (kickedBy == null)
            {
                return;
            }

            Users.Remove(kickedUser);

            WriteTimedMessage($"'{kickedUser.Name}' was kicked from server by '{kickedBy.Name}. Reason: {e.Reason}");
        }
 private static void UserKickHandler(object sender, KickedUserEventArgs e)
 {
     WriteTimedMessage($"User '{e.KickedUser.Name}' was kicked by '{e.KickedBy.Name}' for {e.Reason}.");
 }