Solved PlayerInteractEvent get Item

Discussion in 'Plugin Development' started by Typ, Sep 25, 2016.

Thread Status:
Not open for further replies.
  1. Hello,
    I actually tried many different possible Solutions (all didn't work).
    So, how can I get the item, the Player clicked on something with?

    Thanks for help
    Typ
     
  2. Offline

    Zombie_Striker

    @Typ
    Event#getPlayer().getItemInHand()

    Remember, the item can be null if the player is not holding an item.
     
  3. Worked fine now, thank you very much!
     
  4. @Typ @Zombie_Striker
    Or, the non-deprecated method:
    Code:java
    1. ....getPlayer().getInventory().getItemInMainHand()
     
Thread Status:
Not open for further replies.

Share This Page