Error: PHP: [21:55:37] [Server thread/CRITICAL]: Could not tick level "hub": Call to a member function getBlockAt() on null[21:55:37] [Server thread/CRITICAL]: Error: "Call to a member function getBlockAt() on null" (EXCEPTION) in "src/pocketmine/entity/Entity" at line 1479 code: PHP: public function Fly(PlayerMoveEvent $e): void{ $player = $e->getPlayer(); $from = $e->getFrom(); $to = $e->getTo(); if($player->isFlying()){ $dy = (int)(round($to->getX() - $from->getY(), 3) * 1000); if($player->GetInAirTicks() > 20 && $dy >= 0){ $y = $player->getLevel()->getHighestBlockAt(intval($to->getX()), intval($to->getZ())); if($to->getY() - 5 > $y){ $e->setCancelled(); $player->close("", C::GREEN . "Detected: " . C::RED . "Fly", true); } } if($dy > 0 && $dy % 375 == 0){ $e->setCancelled(); $player->close("", C::GREEN . "Detected: " . C::RED . "Fly", true); } } } i used if($player->isFlying) for testing only xd
Maybe if instead of using player->kick or close after your checks, you set a variable to true, and at the very end of your method that handles the event, if that variable is true, kick the player. That way the plugin isn't trying to use information from a closed player.