/** * Set the "flying" allowed status to a player * * @param Player $player * @param bool $mode * @return bool */ public function setFlying(Player $player, $mode) { $this->getServer()->getPluginManager()->callEvent($ev = new PlayerFlyModeChangeEvent($this, $player, $mode)); if ($ev->isCancelled()) { return false; } $player->setAllowFlight($ev->willFly()); return true; }