PlayerInteractEvent interfering with PlayerInteractEntity event?

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

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

    Barinade

    How can I stop a PlayerInteractEvent if the event is on an entity? They run similar code, but one is using a player that is right clicked.
     
  2. Offline

    caseif

    You should be able to listen to and cancel EntityInteractWithEntityEvent.
     
  3. Offline

    Barinade

    No such event, not even close to the answer I was looking for, thanks for trying.
     
  4. Offline

    Alshain01

    They shouldn't be interacting. PlayerInteractEvent is only for blocks (including air blocks), it shouldn't be firing for entities. If it is, it is likely a bug.
     
  5. Offline

    Barinade

    Well, it is. One (interact) has conditions to meet on block/air right click, and the other (interact entity) has the same conditions, but on an entity.
     
  6. Offline

    Alshain01

    What are you clicking that is making both events fire? It has to be either a block or an entity, it can't be both. There is nothing that is both Block and Entity.
     
  7. Offline

    caseif

    Sorry, there's something like that. I really haven't done much with the Bukkit API in a while, so I'm starting to forget things. But, there's definitely an event for this.

    EDIT: Alright, reading back over this, I completely misread the question. Sorry about that. I'm going to go to bed now, because it's like 1 AM and I clearly can't think straight.
     
  8. Offline

    Barinade

    I sort of fixed it. I checked to see if the interact entity had passed, and cancelled the interact if so.

    Still looking for a better way to solve this.
     
  9. Offline

    Minesuchtiiii

    Barinade
    Do you have put some
    Code:java
    1. else {
    2. return; //or what ever you want :)
    3. }

    else it will do this at every thing which the } belongs to .. don't know if you understand.. my english is bad I know :D
     
  10. Offline

    Barinade

    I know what return does, lol. That's precisely what I used.
    I'm looking for a better method, if there is any.
     
Thread Status:
Not open for further replies.

Share This Page