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

How can i use PlayerInteractEvent at least 2 times?

Discussion in 'General discussion' started by AndreKim, Jul 28, 2018.

  1. AndreKim

    AndreKim Silverfish

    Messages:
    22
    GitHub:
    overtook

    When i click air PlayerInteractEvent occurs only one time, but i want to use PlayerInteractEvent many times.

    (See Attached Media)

    sry for my bad eng
     
  2. AndreKim

    AndreKim Silverfish

    Messages:
    22
    GitHub:
    overtook
    See 00:21 (Quick Shot)
     
  3. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
  4. AndreKim

    AndreKim Silverfish

    Messages:
    22
    GitHub:
    overtook
  5. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    To break the loop, it’s actually IN that link
     
  6. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    $this->getServer()->getPluginManager()->callEvent($event);

    You can use public $time = 0 and on each interaction do $this->time++; then check if the time is 5 for an example so you won't recall the event
     
  7. AndreKim

    AndreKim Silverfish

    Messages:
    22
    GitHub:
    overtook
    no, i already know how to use loop and break the loop well.
    but i have to know when Player starts interact and finish the interact.

    i already use InventoryTranscationPacket but doesn't active.
     
    Last edited: Jul 29, 2018
  8. AndreKim

    AndreKim Silverfish

    Messages:
    22
    GitHub:
    overtook
    sorry. due to my bad eng, i didn't understood. can u explain more easier?
    sorry
     
  9. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    Recall the event. Make a small timer otherwise it will be called forever.
     
  10. AndreKim

    AndreKim Silverfish

    Messages:
    22
    GitHub:
    overtook
    Why recall the event? I don't know if the player really interacts.
    I'm not saying about Loop.

    I want to know the moment when the player takes his hands off the screen.
    (maybe PlayerInteractEndEvent (end from PlayerInteractEvent::RIGHT_CLICK_AIR) ?)
     
    Last edited: Jul 29, 2018
  11. AndreKim

    AndreKim Silverfish

    Messages:
    22
    GitHub:
    overtook
    I don't know what you mean.

    I want to know the moment when the player takes his hands off the screen.
    (maybe PlayerInteractEndEvent (end from PlayerInteractEvent::RIGHT_CLICK_AIR) ?)

    I have to know if the Player is still interacting.
    (or when Player ended PlayerInteractEvent)
     
  12. AndreKim

    AndreKim Silverfish

    Messages:
    22
    GitHub:
    overtook
    and my intention is to receive PlayerInteractEvent while Player press long.
    so i said "AT LEAST".

    and if u watched my video well, you could know what is my intention. :)

    according what you said, how can he (In the video) receive PlayerInteractEvent continuously while the player is still interacting?
     
  13. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    When you long tap in the air (right click on pc), on PE it spams packets but on PC it doesn't. When you tap on the ground (right click on the ground) PE sends 1 packet, like PC in the air, and PC spams packets. This is how it works. You could use PlayerInteractEvent::LEFT_CLICK_AIR
     
  14. AndreKim

    AndreKim Silverfish

    Messages:
    22
    GitHub:
    overtook
    wow. now i understand. then, i have to change the logic. thx xD :)
     
  15. Winchester

    Winchester Baby Zombie

    Messages:
    133
    I would like the event to enter only 1 time but when using the item the command is executed 3 times
     
  16. Kalis

    Kalis Creeper

    Messages:
    1
    See InventoryTranscationPacket. all of them has different type.
     
  17. Nora1903

    Nora1903 Slime

    Messages:
    82
    GitHub:
    cuongvnz
    How did you spawn lightning entity at the location where you hold tap on screen ?
     
    Last edited: Aug 5, 2018
  18. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    Off-topic, but I will reply. Maybe spawning the entity on the block the player is looking at.
     
  19. Nora1903

    Nora1903 Slime

    Messages:
    82
    GitHub:
    cuongvnz
    Which method to get the block where player is looking ? @@
     
  20. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
  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.