<?php

namespace duel\provider;

use pocketmine\utils\Config;

use duel\Loader;

class YamlProvider implements Provider
{
	
	/** @var Loader */
	private $loader;
	
	/** @var array */
	private $conf;
	
	/**
	  * YamlProvider constructor.
	  * @param Loader $loader
	  */
	public function __construct(Loader $loader)
	{
		$this->loader = $loader;
		$this->load();
	}
	
	public function load()
	{
		$folder = $this->loader->getDataFolder();
		
		if (!is_file($folder))
             @mkdir($folder);
             
         if (!is_file($folder.'arenas'))
               @mkdir($folder.'arenas');
             
                              /** @var Config */
               $config = new Config($folder.'config.yml', Config::YAML, [
                   "Tempo_Iniciar" => "5",
                   "Tempo_Maximo" => "120", 
                   "Hits_Maximo" => "100",
                   "Menu_Status" => "Sim",
                   "Cor_Eventos_Arena" => "§9"
               ]);
                              /** @var Config */
               $config3 = new Config($folder.'SanityIP.yml', Config::YAML, [
                   "IP" => "I dunno",
                   "PORTA" => "19132"
               ]);
                              /** @var Config */
               $config4 = new Config($folder.'Boxing_KB.yml', Config::YAML, [
                   "KB_X" => 1.0,
                   "KB_Y" => 1.25,
                   "KB_Z" => 1.0,
                   "Velocidade" => 10
               ]);
               $config2 = new Config($folder.'status.yml', Config::YAML);
               $this->conf = $config->getAll();
               $this->conf = $config2->getAll();
               $this->conf = $config3->getAll();
               $this->conf = $config4->getAll();
	}
	
}