public bool AddAndCheck(Session session, double cost) { lock (_delays) { double delay; if (!_delays.TryGetValue(session.Address, out delay)) { if (cost > 0) _delays.Add(session.Address, cost); } else { _delays[session.Address] += cost; } var shouldDelay = (delay + cost) >= DelayThreshold; if (shouldDelay) session.SendSysMessage("Too many requests are coming from your location and your request has been canceled. Please wait and try again in a few minutes."); return shouldDelay; } }
public CommandTarget(Session session) { Room = Program.RoomManager.Get(session.Room); Session = session; }
public abstract void Handle(Session session);
public bool Check(Session session) { return AddAndCheck(session, 0); }