<?php

namespace duel\command;

use pocketmine\command\{Command, CommandSender};
use pocketmine\Player;

use duel\Loader;
use pocketmine\utils\Config;

class IpCommand extends Command
{
	
	/** @var Loader */
	public $loader;
	
	
	private $config;
	private $ip;
	
	/**
	  * DuelCommand constructor.
	  */
	public function __construct(Loader $loader)
	{
		parent::__construct("ip", "IP Of The Server.", "/ip", ["ip"]);
		$this->loader = $loader;
        $this->config = new Config($this->loader->getDataFolder() . 'config.yml', Config::YAML);
        $this->ip = new Config($this->loader->getDataFolder() . 'SanityIP.yml', Config::YAML);
	}
	
	/**
	  * @oaram CommandSender $sender
	  * @param string $commandLabel
	  * @param array $args
	  */
	public function execute(CommandSender $sender, $commandLabel, array $args)
	{
		$sender->sendMessage(" ");
		$sender->sendMessage('§fIP: '.$this->config->get('Cor_Eventos_Arena').''.$this->ip->get('IP').'');
		$sender->sendMessage('§fPORTA: '.$this->config->get('Cor_Eventos_Arena').''.$this->ip->get('PORTA').'');
		$sender->sendMessage(" ");
    }
}