BlockEvent Help, Right Click.

Discussion in 'Plugin Development' started by TechHut, Dec 21, 2011.

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

    TechHut

    Hi, I have been trying to figure this out for a while and I couldn't. I was just wanting any information you all know about getting a Event out of shears. For one of my Plugins I'm trying to get it so that when you right click a grass block with shears it will turn the grass block to a dirt black and wild grass will dropItemNaturally

    Here is my code for the onBlockBreak for the main feature in my plugin.
    Code:
    public void onBlockBreak(BlockBreakEvent event)
        {
            Player player = event.getPlayer();
            if(player.getItemInHand().getTypeId() == 359 && event.getBlock().getTypeId() == 2)
            {
                event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), new ItemStack(2, 1));
                event.getBlock().setType(Material.AIR);
            }
        }
    Any Help would be awesome. Thank You.
     
  2. Offline

    Taco

    You want onPlayerInteract() and check for Action.RIGHT_CLICK_BLOCK
     
Thread Status:
Not open for further replies.

Share This Page