Check if item in player his hand is null?

Discussion in 'Plugin Development' started by HungerCraftNL, Mar 2, 2014.

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

    HungerCraftNL

    Hello,

    I'm checking or the item in the player his hand is null:

    code:
    PHP:
    if(p.getItemInHand == null){
      
    //code
    }
    But it doesn't return anything, does someone know the problem?

    Thank you.
     
  2. Offline

    Konkz

    Check if it's Material.AIR
     
    tommycake50 likes this.
  3. Offline

    tommycake50

    More specifically it is 0 amount of Material.AIR.
     
  4. Offline

    HungerCraftNL

    This wasn't the problem lol, the Action.RIGHT_CLICK_AIR don't trigger...

    Code:
    if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
      //code
    }
    Is this a bug?
     
  5. Offline

    tommycake50

    Yep, This is a bug, I have had this problem before.
    Some may argue it works but in practice in my experience RIGHT_CLICK_AIR is never called.
    RIGHT_CLICK_BLOCK does though.
     
  6. Offline

    HungerCraftNL

    tommycake50 So I've to check or the clicked block is air?
     
Thread Status:
Not open for further replies.

Share This Page