HasPermissionToBuildInRegion() публичный Метод

Checks if a given player has permission to build in the region
public HasPermissionToBuildInRegion ( TSPlayer ply ) : bool
ply TSPlayer Player to check permissions with
Результат bool
Пример #1
0
        public bool CanBuild(int x, int y, TSPlayer ply)
        {
            if (!ply.Group.HasPermission(Permissions.canbuild))
            {
                return(false);
            }
            Region top = null;

            for (int i = 0; i < Regions.Count; i++)
            {
                if (Regions[i].InArea(x, y))
                {
                    if (top == null)
                    {
                        top = Regions[i];
                    }
                    else
                    {
                        if (Regions[i].Z > top.Z)
                        {
                            top = Regions[i];
                        }
                    }
                }
            }
            return(top == null || top.HasPermissionToBuildInRegion(ply));
        }
Пример #2
0
        /// <summary>
        /// Checks if a given player can build in a region at the given (x, y) coordinate
        /// </summary>
        /// <param name="x">X coordinate</param>
        /// <param name="y">Y coordinate</param>
        /// <param name="ply">Player to check permissions with</param>
        /// <returns>Whether the player can build at the given (x, y) coordinate</returns>
        public bool CanBuild(int x, int y, TSPlayer ply)
        {
            if (!ply.HasPermission(Permissions.canbuild))
            {
                return(false);
            }
            Region top = null;

            foreach (Region region in Regions.ToList())
            {
                if (region.InArea(x, y))
                {
                    if (top == null || region.Z > top.Z)
                    {
                        top = region;
                    }
                }
            }
            return(top == null || top.HasPermissionToBuildInRegion(ply));
        }