<commit_before>package io.github.vayleryn.vaylerynessentials;

import io.github.vayleryn.vaylerynlib.plugin.essentials.Kit;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;

public class KitManager {
	
	private Map<String, Kit> kits = new HashMap<String, Kit>();
	private VaylerynEssentials plugin;
	
	public KitManager(VaylerynEssentials plugin) {
		this.plugin = plugin;
	}
	
	public Map<String, Kit> getKits() {
		return kits;
	}
	
	public Kit getKit(String name) {
		return kits.get(name);
	}
	
	public void save() {
		File kitFile = new File(plugin.getDataFolder().getPath() + File.separator + "kits.yml");
		YamlConfiguration kitConfig = new YamlConfiguration();
		for (String kitName : kits.keySet()) {
			kitConfig.set(kitName, kits.get(kitName));
		}
		try {
			kitConfig.save(kitFile);
		} catch (IOException exception) {
			exception.printStackTrace();
		}
	}
	
	public void load() {
		File kitFile = new File(plugin.getDataFolder().getPath() + File.separator + "kits.yml");
		YamlConfiguration kitConfig = new YamlConfiguration();
		try {
			kitConfig.load(kitFile);
		} catch (FileNotFoundException exception) {
			exception.printStackTrace();
		} catch (IOException exception) {
			exception.printStackTrace();
		} catch (InvalidConfigurationException exception) {
			exception.printStackTrace();
		}
		for (String kitName : kitConfig.getKeys(false)) {
			kits.put(kitName, (Kit) kitConfig.get(kitName));
		}
	}
	
}<commit_msg>Make sure kit file exists before attempting to load it<commit_after>package io.github.vayleryn.vaylerynessentials;

import io.github.vayleryn.vaylerynlib.plugin.essentials.Kit;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;

public class KitManager {
	
	private Map<String, Kit> kits = new HashMap<String, Kit>();
	private VaylerynEssentials plugin;
	
	public KitManager(VaylerynEssentials plugin) {
		this.plugin = plugin;
	}
	
	public Map<String, Kit> getKits() {
		return kits;
	}
	
	public Kit getKit(String name) {
		return kits.get(name);
	}
	
	public void save() {
		File kitFile = new File(plugin.getDataFolder().getPath() + File.separator + "kits.yml");
		YamlConfiguration kitConfig = new YamlConfiguration();
		for (String kitName : kits.keySet()) {
			kitConfig.set(kitName, kits.get(kitName));
		}
		try {
			kitConfig.save(kitFile);
		} catch (IOException exception) {
			exception.printStackTrace();
		}
	}
	
	public void load() {
		File kitFile = new File(plugin.getDataFolder().getPath() + File.separator + "kits.yml");
		if (kitFile.exists()) {
			YamlConfiguration kitConfig = new YamlConfiguration();
			try {
				kitConfig.load(kitFile);
			} catch (FileNotFoundException exception) {
				exception.printStackTrace();
			} catch (IOException exception) {
				exception.printStackTrace();
			} catch (InvalidConfigurationException exception) {
				exception.printStackTrace();
			}
			for (String kitName : kitConfig.getKeys(false)) {
				kits.put(kitName, (Kit) kitConfig.get(kitName));
			}
		}
	}
	
}
{'fraction_non_alphanumeric': 0.12041420118343195, 'fraction_numerical': 0.0, 'mean_word_length': 4.597682119205298, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4624464', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1041, 'n_words': 225}