pocketmine\Player::setAllowFlight PHP Method

setAllowFlight() public method

public setAllowFlight ( $value )
    public function setAllowFlight($value)
    {
        $this->allowFlight = (bool) $value;
        $this->sendSettings();
    }

Usage Example

示例#1
0
 /**
  * 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;
 }
Player