1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Continuously trigger PlayerInteractEvent until player releases item

Discussion in 'Development' started by Muqsit, Jul 11, 2017.

  1. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Let's take an example of snowballs. While you're *holding down* (PlayerInteractEvent::RIGHT_CLICK_AIR) snowballs, they'll keep decreasing in number until you release your hand off the snowballs, firing PlayerInteractEvent multiple times in a row.
    I want to do the same thing for when a player holds down an item other than snowballs. How would I do this? If I keep holding an item, it will trigger PlayerInteractEvent only once.
     
    Last edited: Jul 11, 2017
  2. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    could u run a task and check the item, if they do call the interact event?
    EDIT: When they call the interact event the first time, could you run a task and check the item. If they have the same item call the interact event from the task?
     
  3. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    maybe just quickly swap head into snowball and once they stopped(using a task to check) swap it back to head?
    not the best but should work
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Of course, there's always a way but that's not what i want. I could have use my 999,999,999 workarounds to get this issue solved.
    It would be better to find whether it's handled by PocketMine/Client and then work on what would be the best solution, if there is any.
     
    Thunder33345 likes this.
  5. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    I've fixed this issue. PlayerActionPacket with $action ACTION_START_BREAK is spammed while the player holds down the item. Thank you for your answers though, pretty close.
     
    Thunder33345 likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.