public virtual bool Ban(PlayerMobile user, TimeSpan duration, bool kick = true, bool message = true) { if (kick) { Kick(user, false, message); } if (Bans.ContainsKey(user)) { Bans[user] = duration <= TimeSpan.Zero ? DateTime.MaxValue : DateTime.Now + duration; return(false); } Bans.Add(user, duration <= TimeSpan.Zero ? DateTime.MaxValue : DateTime.Now + duration); if (message) { InternalMessage(user, "You have been banned from the channel '{0}' until {1}", Name, Bans[user].ToSimpleString()); } OnBanned(user, message); return(true); }
public virtual bool IsBanned(PlayerMobile user) { return(user != null && Bans.ContainsKey(user) && Bans[user] > DateTime.Now); }