Solved How to check for build access with WorldGuard API

Discussion in 'Plugin Development' started by mw3killer, Jul 25, 2013.

Thread Status:
Not open for further replies.
  1. Offline


    I have a plugin that allows players to instantly destroy items if they have a gold pickaxe in their hand. I need to see if they have access to build so that they can't greif any protected WorldGuard regions. I looked in the WorldGuard API Wiki but nothing was making sense. Here is the code that allows them to instantly destroy blocks.
    1. @EventHandler
    2. public void playerInteract(PlayerInteractEvent event) {
    3. Player p = event.getPlayer();
    4. Block block = event.getClickedBlock();
    5. Material item = p.getInventory().getItemInHand().getType();
    7. if ((event.getAction() == Action.LEFT_CLICK_BLOCK) && (item == Material.GOLD_PICKAXE) && (block.getLocation().getY() > 0.0D) && (block.getType() != Material.BEDROCK) && (p.hasPermission("instabreak.break"))) {
    8. block.setType(Material.AIR);
    9. }
    10. }

    How would I use the API to check if they have access to build? Thanks!

    I found another thread with the same answer.


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 3, 2016
Thread Status:
Not open for further replies.

Share This Page