Right click Material.FIRE

Discussion in 'Spigot Plugin Development' started by Christophe6, Apr 19, 2017.

  1. Hello

    I try to open a GUI upon right clicking Material.FIRE, but it doesn't work with fire only.
    I believe this is because you can't right click fire... Are there any ways to do it?
     
  2. md_5

    Administrator Developer

    You won't get a right click event if you have no item in your hand.
    This is a client limitation.
     
  3. @md_5
    Thank you for your reply! I tried using the PlayerInteractEvent.
    Don't understand why it wouldn't work without an item in your hand as you can always open doors.
    So basically I want when a player right clicks on fire (ingame block not in inventory), I want it to open the GUI (player.openInventory(inv);).
     
  4. md_5

    Administrator Developer

    Right clicking air definitely doesn't fire an event if you aren't holding anything.
    I haven't checked fire, but I wouldn't be surprised if this was the case too.
     
    • Useful Useful x 1
  5. Thank you! But is there a way to check if is right clicking fire?
     
  6. It does for me... When I had to debug for my premium plugin once and I got a message when right clicking the air with no item in hand.
     
  7. Yeah I'm sure I done this while testing a particle effect I was working on.
     
  8. getTargetblock and then check if the block is fire?
     
  9. Will that work? Air isn't logged too with getTargetBlock...
     
    #9 Christophe6, Apr 25, 2017
    Last edited: Apr 26, 2017
  10. That should work out for you. Make sure to import the correct fire though (I believe are both Block and Material).
     
  11. I'm going to try this so let me try it :)