You can check if the player flies: PHP: public $AirState = [];public function onMove(PlayerMoveEvent $event){$player = $event->getPlayer();if($this->getServer()->getBlockIdAt($player->x, $player->y - 1, $player->z) == 0){if(in_array($this->AirState, $player->getName()){$this->AirState[$player->getName()] = $this->AirState[$player->getName] + 1;if($this->AirState[$player->getName()] > 60 /* 3 seconds */){$player->kick("Flying to allowed.");unset($this->AirState[$player->getName()];}else{$this->AirState[$player->getName()] = 1;}}else{if(in_array($this->AirState, $player->getName()){unset($this->AirState[$player->getName()];}} You could also use a scheduler to check if the player doesnt move but is in the air.
If you really use your brain, you would realize that your method is unreliable that: 1. It will not increment if player is stationary mid-air. 2. It rounds down the coordinates, so flying 0.5 block above ground would not be counted. 3. https://php.net/in-array check the correct usage. 4. There is something called the increment operator. 5. It is a waste of resources to try to count that yourself while PocketMine already does that. Although hacky, using reflections is at least more reliable than your one.