Exemplo n.º 1
0
        public void RemoveID(int id)
        {
            var index = -1;

            for (int i = 0; i < AllowedIDs.Count; i++)
            {
                if (AllowedIDs[i] == id)
                {
                    index = i;
                    break;
                }
            }
            AllowedIDs.RemoveAt(index);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Checks if a given player has permission to build in the region
        /// </summary>
        /// <param name="ply">Player to check permissions with</param>
        /// <returns>Whether the player has permission</returns>
        public bool HasPermissionToBuildInRegion(TSPlayer ply)
        {
            if (!DisableBuild)
            {
                return(true);
            }
            if (!ply.IsLoggedIn)
            {
                if (!ply.HasBeenNaggedAboutLoggingIn)
                {
                    ply.SendMessage("You must be logged in to take advantage of protected regions.", Color.Red);
                    ply.HasBeenNaggedAboutLoggingIn = true;
                }
                return(false);
            }

            return(ply.HasPermission(Permissions.editregion) || AllowedIDs.Contains(ply.Account.ID) || AllowedGroups.Contains(ply.Group.Name) || Owner == ply.Account.Name);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Checks if a given player has permission to build in the region
        /// </summary>
        /// <param name="ply">Player to check permissions with</param>
        /// <returns>Whether the player has permission</returns>
        public bool HasPermissionToBuildInRegion(TSPlayer ply)
        {
            if (!DisableBuild)
            {
                return(true);
            }
            if (!ply.IsLoggedIn)
            {
                if (!ply.HasBeenNaggedAboutLoggingIn)
                {
                    ply.SendMessage("登录后才能使用此被保护的区域.", Color.Red);
                    ply.HasBeenNaggedAboutLoggingIn = true;
                }
                return(false);
            }

            return(ply.HasPermission(Permissions.editregion) || AllowedIDs.Contains(ply.User.ID) || AllowedGroups.Contains(ply.Group.Name) || Owner == ply.User.Name);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Removes a user's access to the region
 /// </summary>
 /// <param name="id">User ID to remove</param>
 /// <returns>true if the user was found and removed from the region's allowed users</returns>
 public bool RemoveID(int id)
 {
     return(AllowedIDs.Remove(id));
 }