package com.zivilon.cinder_loe;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import java.io.File;

import lotr.common.fac.LOTRFaction;
import net.minecraftforge.common.config.Configuration;

public class CinderLoE_Config {
    public static Configuration config;
    public static float enchantment_color_red;
    public static float enchantment_color_green;
    public static float enchantment_color_blue;
    public static String corrupt_faction;

    public static void init(FMLPreInitializationEvent event) {
        File configFile = new File(event.getModConfigurationDirectory(), "CinderLoE.cfg");
        config = new Configuration(configFile);
        syncConfig();
    }

    public static void syncConfig() {
        try {
            // Load the configuration file
            config.load();

            // Read properties, define categories and keys
            enchantment_color_red = config.getFloat("EnchantmentColorRed", Configuration.CATEGORY_GENERAL, 0.38f, 0.0f, 1.0f, "Configure red color for enchantments");
            enchantment_color_green = config.getFloat("EnchantmentColorGreen", Configuration.CATEGORY_GENERAL, 0.19f, 0.0f, 1.0f, "Configure green color for enchantments");
            enchantment_color_blue = config.getFloat("EnchantmentColorBlue", Configuration.CATEGORY_GENERAL, 0.608f, 0.0f, 1.0f, "Configure blue color for enchantments");

            corrupt_faction = config.getString("CorruptFaction", Configuration.CATEGORY_GENERAL, "MORDOR", "Configure the alignment the Corrupt npcs follow");
            // Save the configuration if it has changed
            if (config.hasChanged()) {
                config.save();
            }
        } catch (Exception e) {
        }
    }
}
