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

Check fly enable

Discussion in 'Development' started by #A6543, Feb 23, 2017.

  1. kaliiks

    kaliiks Zombie

    Messages:
    250
    PlayerMoveEvent
     
  2. #A6543

    #A6543 Zombie

    Messages:
    267
    And how can I check the packet? If the player kklicked jump?
     
  3. kaliiks

    kaliiks Zombie

    Messages:
    250
    PlayerJumpEvent
     
  4. #A6543

    #A6543 Zombie

    Messages:
    267
    There is no event with that name. Lol
     
  5. kaliiks

    kaliiks Zombie

    Messages:
    250
    Oh, sorry so
    PHP:
      if($event->getTo()->getY() > $event->getFrom()->getY() && $block->getId() == 0) {
     
  6. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    but that dosent work if they jump in air
     
    #A6543 likes this.
  7. kaliiks

    kaliiks Zombie

    Messages:
    250
    Player can not jump in air
     
  8. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    so that wont work if they are in air,
    so your method is not very accurate for testing double tap of the jump button
     
  9. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    To be real honest there is no proper way of detecting if someone is trying to fly in survival mode. None of the work arounds are consistend and reliable, you could check if a player hasn't been on the ground for so many seconds and kick him if that's the case, but it might as well be fall damage or huge lag.
     
  10. CraftYourBukkit

    CraftYourBukkit Creeper

    Messages:
    3
    This code checks whether a player is double-tapping the jump button and it enables flight (this does not trigger when just double tapping without hacking.). Didn't test it, but should work.
    PHP:
    public function onPacketReceive(DataPacketReceiveEvent $event){
        
    $player $event->getPlayer();
        
        if(
    $event->getPacket() instanceof AdventureSettingsPacket) {
            
    // Packet buffers
            // 37e60400 - Enable fly
            // 376600 - disable fly
            
    if(!$this->allowFlight && ($packet->flags >> 9) & 0x01 === 1) || (!$this->isSpectator() && ($packet->flags >> 7) & 0x01 === 1){
                
    // Fly button used
            
    }
        }
    }
     
  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.