Mute() публичный Метод

Mutes this player (prevents from writing chat messages).
public Mute ( [ player, System.TimeSpan duration, bool announce, bool raiseEvents ) : void
player [ Player who is doing the muting.
duration System.TimeSpan Duration of the mute. If a player is already muted for same or greater length of time, /// PlayerOpException is thrown with NoActionNeeded code. If a player is already muted for a shorter length of time, /// the mute duration is extended.
announce bool Whether to announce muting publicly on the sever.
raiseEvents bool Whether to raise PlayerInfo.MuteChanging and MuteChanged events.
Результат void
Пример #1
0
 bool DetectChatSpam()
 {
     if (this == Console)
     {
         return(false);
     }
     if (spamChatLog.Count >= SpamChatCount)
     {
         DateTime oldestTime = spamChatLog.Dequeue();
         if (DateTime.UtcNow.Subtract(oldestTime).TotalSeconds < SpamChatTimer)
         {
             muteWarnings++;
             if (muteWarnings > ConfigKey.AntispamMaxWarnings.GetInt())
             {
                 Session.KickNow("You were kicked for repeated spamming.", LeaveReason.MessageSpamKick);
                 Server.SendToAll("&W{0} was kicked for repeated spamming.", GetClassyName());
             }
             else
             {
                 Info.Mute("(antispam)", AutoMuteDuration);
                 Message("You have been muted for {0} seconds. Slow down.", AutoMuteDuration.TotalSeconds);
             }
             return(true);
         }
     }
     spamChatLog.Enqueue(DateTime.UtcNow);
     return(false);
 }