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

help me PlayerActionPacket

Discussion in 'Development' started by TheStepKla, Sep 28, 2019.

  1. TheStepKla

    TheStepKla Silverfish

    Messages:
    20
    help me PlayerActionPacket
    Code:
    function onReceive (DataPacketReceiveEvent $event)
        {
            $player = $event->getPlayer();
            $name = $player->getName();
            $pk = $event->getPacket();
            if ($pk::NETWORK_ID == ProtocolInfo::PLAYER_ACTION_PACKET) {
                if ($pk->action == PlayerActionPacket::ACTION_ABORT_BREAK) {
                    $id = $player->getInventory()->getItemInHand()->getId();
                    switch ($id) {
    Click hold not work
     
    Last edited: Sep 28, 2019
  2. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    if($pk instanceof PlayerActionPacket){

    this looks better
     
  3. TheStepKla

    TheStepKla Silverfish

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