<commit_before><?php

namespace BlockHorizons\BlockSniper\presets;

use BlockHorizons\BlockSniper\Loader;
use pocketmine\Player;
use pocketmine\utils\TextFormat as TF;

class PresetManager {
	
	public $presetCreation = [];
	private $loader;
	private $data;
	private $preset;
	
	public function __construct(Loader $loader) {
		$this->loader = $loader;
		
		if(is_file($loader->getDataFolder() . "presets.yml")) {
			$this->data = yaml_parse_file($loader->getDataFolder() . "presets.yml");
			foreach($this->data as $name => $data) {
				$this->addPreset($name);
				$loader->getLogger()->debug(TF::GREEN . "Preset " . $name . " has been loaded.");
			}
			unlink($loader->getDataFolder() . "presets.yml");
			$loader->getLogger()->info(TF::GREEN . "All presets have been loaded.");
		}
	}
	
	/**
	 * @param string $name
	 */<commit_msg>Don't unlink the presets.yml, in case of killed server.<commit_after><?php

namespace BlockHorizons\BlockSniper\presets;

use BlockHorizons\BlockSniper\Loader;
use pocketmine\Player;
use pocketmine\utils\TextFormat as TF;

class PresetManager {
	
	public $presetCreation = [];
	private $loader;
	private $data;
	private $preset;
	
	public function __construct(Loader $loader) {
		$this->loader = $loader;
		
		if(is_file($loader->getDataFolder() . "presets.yml")) {
			$this->data = yaml_parse_file($loader->getDataFolder() . "presets.yml");
			foreach($this->data as $name => $data) {
				$this->addPreset($name);
				$loader->getLogger()->debug(TF::GREEN . "Preset " . $name . " has been loaded.");
			}
			$loader->getLogger()->info(TF::GREEN . "All presets have been loaded.");
		}
	}
	
	/**
	 * @param string $name
	 */
{'fraction_non_alphanumeric': 0.16998191681735986, 'fraction_numerical': 0.0, 'mean_word_length': 4.1234567901234565, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7317252', 'n_tokens_mistral': 619, 'n_tokens_neox': 558, 'n_words': 114}