예제 #1
0
        public AccessResult Check(string name, LevelPermission rank)
        {
            if (Blacklisted.CaselessContains(name))
            {
                return(AccessResult.Blacklisted);
            }
            if (Whitelisted.CaselessContains(name))
            {
                return(AccessResult.Whitelisted);
            }

            if (rank < Min)
            {
                return(AccessResult.BelowMinRank);
            }
            if (rank > Max && MaxCmd != null && !CommandExtraPerms.Find(MaxCmd, 1).UsableBy(rank))
            {
                return(AccessResult.AboveMaxRank);
            }
            return(AccessResult.Allowed);
        }
예제 #2
0
        /// <summary> Returns the allowed state for the given player. </summary>
        public AccessResult Check(string name, Group rank)
        {
            if (Blacklisted.CaselessContains(name))
            {
                return(AccessResult.Blacklisted);
            }
            if (Whitelisted.CaselessContains(name))
            {
                return(AccessResult.Whitelisted);
            }

            if (rank.Permission < Min)
            {
                return(AccessResult.BelowMinRank);
            }
            if (rank.Permission > Max && MaxCmd != null && rank.Permission < CommandExtraPerms.MinPerm(MaxCmd))
            {
                return(AccessResult.AboveMaxRank);
            }
            return(AccessResult.Allowed);
        }
예제 #3
0
        public bool Blacklist(Player p, LevelPermission plRank, Level lvl, string target)
        {
            if (!CheckList(p, plRank, target, false))
            {
                return(false);
            }
            if (Blacklisted.CaselessContains(target))
            {
                p.Message("{0} %Sis already blacklisted.", p.FormatNick(target));
                return(true);
            }

            bool removed = true;

            if (!Whitelisted.CaselessRemove(target))
            {
                Blacklisted.Add(target);
                removed = false;
            }
            OnListChanged(p, lvl, target, false, removed);
            return(true);
        }
예제 #4
0
        public bool Blacklist(Player p, string target)
        {
            if (!CheckList(p, target, false))
            {
                return(false);
            }
            if (Blacklisted.CaselessContains(target))
            {
                Player.Message(p, "{0} %Sis already blacklisted.", PlayerInfo.GetColoredName(p, target));
                return(true);
            }

            bool removed = true;

            if (!Whitelisted.CaselessRemove(target))
            {
                Blacklisted.Add(target);
                removed = false;
            }
            OnListChanged(p, target, false, removed);
            return(true);
        }