TShockAPI.DB.Region.RemoveGroup C# (CSharp) Method

RemoveGroup() public method

Removes a group's access to the region
public RemoveGroup ( string groupName ) : bool
groupName string Group name to remove
return bool
        public bool RemoveGroup(string groupName)
        {
            return AllowedGroups.Remove(groupName);
        }

Usage Example

コード例 #1
0
ファイル: RegionManager.cs プロジェクト: xglync/TShock
        /// <summary>
        /// Removes a group's access to a region
        /// </summary>
        /// <param name="regionName">Region name</param>
        /// <param name="group">Group name</param>
        /// <returns>Whether the change was successfull</returns>
        public bool RemoveGroup(string regionName, string group)
        {
            Region r = GetRegionByName(regionName);

            if (r != null)
            {
                r.RemoveGroup(group);
                string groups = string.Join(",", r.AllowedGroups);
                int    q      = database.Query("UPDATE Regions SET `Groups`=@0 WHERE RegionName=@1 AND WorldID=@2", groups,
                                               regionName, Main.worldID.ToString());
                if (q > 0)
                {
                    return(true);
                }
            }
            return(false);
        }