ui spam

Discussion in 'Development' started by Angel, Aug 12, 2019.

  1. Angel

    Angel Spider Jockey

    Messages:
    48
    GitHub:
    angelsflyyin
    So, I send a UI on PlayerInteractEvent and when I try to esc from the ui or click on one of the button's I just get the same form again. Any help?
     
  2. Gianluxx

    Gianluxx Witch

    Messages:
    51
    GitHub:
    Gianluxx
    playerinteractevent is called 4 times (multiple times) when right clicking on w10. Put the player in an array and if already in the array, dont send him the form. when he replies to the form, remove the player from the array
     
    HimbeersaftLP likes this.
  3. Angel

    Angel Spider Jockey

    Messages:
    48
    GitHub:
    angelsflyyin
    any other work arounds? can I just cancel a certain packet?
     
  4. Fadhel

    Fadhel Spider Jockey

    Messages:
    27
    GitHub:
    FadhelFS
    PHP:
    private $players = [];
    private 
    $wait 2;
    public function 
    onInteract(PlayerInteractEvent $event){
    $player $event->getPlayer();
    $item $event->getItem();
    if(
    $item->getCustomName === "foo"){
    $name $player->getName();
    if(!isset(
    $this->players[$name]) or time() > $this->players[$name]){
    $this->players[$name] = time() + $this->wait;
    //TODO
    }else{
    $event->setCancelled();
     

Share This Page

  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.