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

How to get Last PacketReceived?

Discussion in 'Plugin Help' started by GodWeedZao, Aug 10, 2020.

  1. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    i need this, please if anyone know ,how can i get && check last packet received by player?
    for example i want check if last packetreceived by player is Movepk, echo " Testing ";

    thanks a lot to Helpers.
     
  2. hexmor

    hexmor Baby Zombie

    Messages:
    110
    GitHub:
    h3xmor
    public function onDataPacketRevice(DataPacketReceiveEvent $event){
    if($event->getPlayer() instanceof Player) { // ik its player . just to make sure
    if($event->getPacket() Instanceof MovePlayerPacket) echo "testing";
    }
    }
    }
     
  3. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    no no, i want get last packet, i dont want check if player received Movepk echo stuff, please read thread a gain.
     
  4. hexmor

    hexmor Baby Zombie

    Messages:
    110
    GitHub:
    h3xmor
    save every packet to an array . then check it . could be laggy
     
  5. hexmor

    hexmor Baby Zombie

    Messages:
    110
    GitHub:
    h3xmor
    public function onDataPacketRevice(DataPacketReceiveEvent $event){
    $this->array[$player->getName()] = $event->getPacket();
    }

    use this to check :
    if(isset($this->array[$player->getName()]) && $this->array[$player->getName()] instanceof MovePlayerPacket)) echo "text";
     
  6. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    done, i looked at your plugin chatUnderName and i see how do you get lastMessage, you save it to array, now im doing that, it should solved, thank you anyway.
     
  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.