Right click air is fine, right click block does it twice

Discussion in 'Plugin Development' started by MdsCool, Dec 23, 2016.

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


    I'm making a magic clock (hiding/showing players) and when they right click air, it's fine.
    But when they right click a block, it does it TWICE, so it shows then hides.
    Don't understand why that is happening.
    - Mds
  2. @MdsCool
    The event is fired once for each hand. Use the getHand() method to check if it's the hand you want. (EquipmentSlot.HAND is the main hand).
    MdsCool likes this.
  3. Offline


    @MdsCool Spigot has been doing a pretty awful job with the documentation of event changes, and this is one of them.

    EDIT: I have submitted a pull request to the Bukkit repo to add this behavior to the documentation. Hopefully you will see it soon.
    Last edited: Dec 23, 2016
    MdsCool and DoggyCodeâ„¢ like this.
  4. Offline


    Doesn't explain why the air is doing it once and the block is doing it twice though...
  5. Offline


    @MdsCool If this is a PlayerInteractEvent, I believe that your left hand will only fire the event when it has a block to interact with. Exceptions to this rule are things such as blocking with a sword or eating. The other hand has a weird way of handling interaction.
    MdsCool likes this.
Thread Status:
Not open for further replies.

Share This Page