Beispiel #1
0
        public bool CanUseCommand(int x, int y, int x2, int y2)
        {
            CanEditEventArgs args = new CanEditEventArgs(plr, x, y, x2, y2);

            WorldEdit.CanEdit.Invoke(args);
            if (args.CanEdit.HasValue)
            {
                if (!args.CanEdit.Value)
                {
                    plr.SendErrorMessage("You do not have permission to use this command in this area.");
                }
                return(args.CanEdit.Value);
            }

            if (plr.HasPermission("worldedit.usage.everywhere"))
            {
                return(true);
            }

            bool noRegion = plr.HasPermission("worldedit.usage.noregion");

            if (!noRegion && !plr.IsLoggedIn)
            {
                plr.SendErrorMessage("You have to be logged in to use this command.");
                return(false);
            }

            Rectangle area = new Rectangle(x, y, x2 - x, y2 - y);

            if ((!noRegion && !TShock.Regions.Regions.Any(r => r.Area.Contains(area))) ||
                !TShock.Regions.CanBuild(x, y, plr) ||
                !TShock.Regions.CanBuild(x2, y, plr) ||
                !TShock.Regions.CanBuild(x2, y2, plr) ||
                !TShock.Regions.CanBuild(x, y2, plr))
            {
                plr.SendErrorMessage("You do not have permission to use this command outside of your regions.");
                return(false);
            }

            return(true);
        }
Beispiel #2
0
 private void geniusTreeView1_OnBeforeEdit(GeniusTreeView Sender, CanEditEventArgs e)
 {
     //
 }