How can I get a listener for right click with now Item in the Hand

Discussion in 'Plugin Development' started by lgplay, Jun 1, 2020.

Thread Status:
Not open for further replies.
  1. Hi, I want to create a Plugin which would need to listen for right clicks even if he hasn't an Item in the Hand and clicks into the air.
     
  2. Offline

    yPedx

  3. Offline

    KarimAKL

    @yPedx I don't think the PlayerInteractEvent is called when right clicking air without an item.
     
  4. @yPedx yes exactly that's my problem
     
  5. Offline

    yPedx

    @KarimAKL @lgplay
    Ah, I had to search that up actually, I was certain it still fired the event. It's been such a long time since I've used this event too, haha. It turns out that the client actually doesn't send any packets upon right clicking air with no item, so.. that's that.

    Perhaps an ugly workaround would be a resource pack that had no texture for a specific item.
     
  6. Offline

    TerroDoor

    You can use a method in the PlayerInteractEvent called ‘event.getAction()’ and check for a ‘Action.RIGHT_CLICK_AIR’

    @timtower
    @KarimAKL correct me if I’m wrong

    Sent from my iPhone using Tapatalk
     
  7. Offline

    timtower Administrator Administrator Moderator

    Think you missed the part in the thread where people said that it didn't fire at all.
     
  8. Offline

    TerroDoor

    @timtower

    Have the listeners been registered in the onEnable? Also events need quotations too don’t they? ‘@EventHandler’


    Sent from my iPhone using Tapatalk
     
  9. Offline

    timtower Administrator Administrator Moderator

    See this:
     
Thread Status:
Not open for further replies.

Share This Page