Ejemplo n.º 1
0
        public SerializableDictionary <int, VirtualServerEntity.Ban> GetBans(bool cache = false)
        {
            if (!cache || _isNewBans)
            {
                _isNewBans = false;

                // clear
                _entity.Bans.Clear();

                // add
                int cb = 0;
                foreach (var b in _server.getBans())
                {
                    _entity.Bans.Add(cb, new VirtualServerEntity.Ban()
                    {
                        Address  = b.address,
                        Bits     = b.bits,
                        Duration = b.duration,
                        Hash     = b.hash,
                        Name     = b.name,
                        Reason   = b.reason,
                        Start    = (int)b.start // cast long->int needed to compatible with v1.2.2
                    });
                    cb++;
                }
            }
            return(_entity.Bans);
        }