How to cancel one event while another is running

Discussion in 'Plugin Development' started by AKZOBIE74, Oct 20, 2014.

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

    AKZOBIE74

    Hey guys so i have a spells plugin and i have two PlayerInteractEvents. How do i cancel one PlayerInteractEvent while another is running. One Event scrolls through the list of spells forward and the other scrolls backwards through the list of spells i want to cancel the scroll forward while the scroll backwards is running.

    P.S. If you respond please tag me or i wont know you responded. I also clicked watch thread but I like being tagged better.
     
  2. Offline

    tcvs

    AKZOBIE74 Why do you have two different PlayerInteractEvents? Why can't you just use one?
     
    FerusGrim likes this.
  3. Offline

    AKZOBIE74

    tcvs I just like it better that way anyways in one player interact you right click to scroll forwards and in the other one you shift and right click to scroll backwards.
     
  4. Offline

    Gater12

    AKZOBIE74
    Well in the first one you check if the player is not shifting?
     
  5. Offline

    tcvs

    AKZOBIE74 That makes no sense... But anyways just use an if statement to check which thing needs to be done.
     
  6. Offline

    FerusGrim

    What are you even...? What?
     
  7. Offline

    AKZOBIE74

    Gater12 tcvs FerusGrim I just want it when you shift and right click to scroll backwards it cancels the event where if you just do a regular right click to scroll forward.
     
  8. Offline

    FerusGrim

    I'm... so confused.
     
  9. Offline

    tcvs

    FerusGrim AKZOBIE74 I was not talking about cancelling the event. I was saying since he is so intent that he wants two event handlers(I still don't know why?). But he would need to do some sort test to see which one to use.
     
  10. Offline

    fireblast709

    AKZOBIE74 in the first lines of the event handler, check if the user is shift clicking. If it is, depending on whether the event handler listens for shift clicking, return.
     
  11. Offline

    AKZOBIE74

    fireblast709 I have the isSneaking and the rutrun but whenever you shift and right click it brings it one back and two forward so that's why i need to have the rightclickevent canceled while the right+shiftevent is being used by the player.
     
  12. Offline

    fireblast709

    AKZOBIE74 if you cancel one, then you cancel the other. That's why you return when in the shift+rightclick event hander when there is no shift. (and vice versa)
     
  13. Offline

    guitargun

    what about the ignore if cancelled?
     
  14. Offline

    AKZOBIE74

    guitargun could you show me a code for the ignore if cancelled?
     
  15. Offline

    guitargun

    just add this. @EventHandler (ignoreCancelled = true)
    not sure if safe to do.
     
  16. AKZOBIE74 Can you show us the code you currently have?
     
  17. Offline

    AKZOBIE74

  18. Offline

    mythbusterma

     
Thread Status:
Not open for further replies.

Share This Page