<?php

	
namespace MCPETRADE\MultiTradeAPI\Commands;

use pocketmine\Player;
use pocketmine\command\CommandSender;
use pocketmine\utils\TextFormat as TE;

use MCPETRADE\MultiTradeAPI\MTAPI;
use MCPETRADE\MultiTradeAPI\Commands\BaseCommand;

Class FlyCommand extends BaseCommand
{	
	public function __construct(MTAPI $plugin)
	{
		parent::__construct($plugin, "fly", "Включить\выключить режим полёта");
		$this->getPlugin()->getLogger()->notice(TE::LIGHT_PURPLE . "Fly загружен.");
		$this->setPermission("trade.commands.fly");
	}
	
	public function execute(CommandSender $sender, $command, array $args)
	{
		if(!($sender instanceof Player)) return;
		if(!$this->testPermission($sender)) return;
		if($sender->getAllowFlight(true)){
			$sender->setAllowFlight(false);
			$sender->sendMessage($this->getPlugin()->getPrefix() . "§f Вы§b успешно §cотключили §fрежим полёта!");
		}else{
			$sender->setAllowFlight(true);$sender->sendMessage($this->getPlugin()->getPrefix() . "§f Вы§b успешно §aвключили §fрежим полёта!");
		}
	}
}

?>