Left/Right Click events?

Discussion in 'Plugin Development' started by hpdvs2, Mar 13, 2012.

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

    hpdvs2

    I'm trying to get a left/right click event and having trouble accomplishing this.
    I've searched for a while, but haven't found a solution that is working. I've used PlayerInteractEvent and BlockDamageEvent so far, but neither appear to be doing anything. (I have blockDamage exit if getPlayer returns null)

    What events should I be attaching to?

    I just want right/left click on block events.
     
  2. Use PlayerInteractEvent ;)

    and then:
    Action a = event.getAction()
    if(a.equals(Action.RIGHT_CLICK_BLOCK){...
     
  3. Offline

    LightnessPL

    Code:
    public void onPlayerInteract(PlayerInteractEvent event) 
    {
    final Action action = event.getAction();
      if (action == Action.LEFT_CLICK_BLOCK) {
    }
    }
     
  4. Offline

    hpdvs2

    Awesome, thanks, this is what I was looking for!
     
Thread Status:
Not open for further replies.

Share This Page