Beispiel #1
0
 internal void BanValidateCheck(object sender, BanEventArgs args)
 {
     //Only perform validation if the event has not been cancelled before we got here
     if (args.Valid)
     {
         //We consider a ban to be valid if the start time is before now and the end time is after now
         args.Valid = (DateTime.UtcNow > args.Ban.BanDateTime && DateTime.UtcNow < args.Ban.ExpirationDateTime);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Determines whether or not a ban is valid
        /// </summary>
        /// <param name="ban"></param>
        /// <param name="player"></param>
        /// <returns></returns>
        public bool IsValidBan(Ban ban, TSPlayer player)
        {
            BanEventArgs args = new BanEventArgs
            {
                Ban    = ban,
                Player = player
            };

            OnBanValidate?.Invoke(this, args);

            return(args.Valid);
        }