<commit_before>package com.github.lunatrius.core.handler;

import com.github.lunatrius.core.lib.Reference;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class ConfigurationHandler {
	public static final String CATEGORY_VERCHECK = "versioncheck";
	public static final String CHECKFORUPDATES = "checkForUpdates";
	public static final String CHECKFORUPDATES_DESC = "Should the mod check for updates?";
	public static final String SILENCEKNOWNUPDATES = "silenceKnownUpdates";
	public static final String SILENCEKNOWNUPDATES_DESC = "Should the mod remind you only for new updates (once per version)?";
	public static final String KNOWNVERSIONS = "knownVersions";
	public static final String KNOWNVERSIONS_DESC = "A list of known updates. Deleting versions from the list will remind you about them again.";
	public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config";

	public static Configuration configuration;

	public static boolean checkForUpdates = true;
	public static boolean silenceKnownUpdates = false;

	private static Property propCheckForUpdates = null;
	private static Property propSilenceKnownUpdates = null;
	private static Property propKnownUpdates = null;

	public static void init(File configFile) {
		if (configuration == null) {
			configuration = new Configuration(configFile);
			loadConfiguration();
		}
	}

	private static void loadConfiguration() {
		propCheckForUpdates = configuration.get(CATEGORY_VERCHECK, CHECKFORUPDATES, checkForUpdates, CHECKFORUPDATES_DESC);
		propCheckForUpdates.setLanguageKey(String.format("%s.%s", LANG_PREFIX, CHECKFORUPDATES));
		propCheckForUpdates.setRequiresMcRestart(true);
		checkForUpdates = propCheckForUpdates.getBoolean(checkForUpdates);

		propSilenceKnownUpdates = configuration.get(CATEGORY_VERCHECK, SILENCEKNOWNUPDATES, silenceKnownUpdates, SILENCEKNOWNUPDATES_DESC);
		propSilenceKnownUpdates.setLanguageKey(String.format("%s.%s", LANG_PREFIX, SILENCEKNOWNUPDATES));
		propSilenceKnownUpdates.setRequiresMcRestart(true);
		silenceKnownUpdates = propSilenceKnownUpdates.getBoolean(silenceKnownUpdates);

		propKnownUpdates = configuration.get(CATEGORY_VERCHECK, KNOWNVERSIONS, new String[0], KNOWNVERSIONS_DESC);
		propKnownUpdates.setShowInGui(false);

		if (configuration.hasChanged()) {
			configuration.save();
		}
	}<commit_msg>Make the configuration defaults proper, final defaults.<commit_after>package com.github.lunatrius.core.handler;

import com.github.lunatrius.core.lib.Reference;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class ConfigurationHandler {
	public static final String CATEGORY_VERCHECK = "versioncheck";
	public static final String CHECKFORUPDATES = "checkForUpdates";
	public static final String CHECKFORUPDATES_DESC = "Should the mod check for updates?";
	public static final String SILENCEKNOWNUPDATES = "silenceKnownUpdates";
	public static final String SILENCEKNOWNUPDATES_DESC = "Should the mod remind you only for new updates (once per version)?";
	public static final String KNOWNVERSIONS = "knownVersions";
	public static final String KNOWNVERSIONS_DESC = "A list of known updates. Deleting versions from the list will remind you about them again.";
	public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config";

	public static Configuration configuration;

	public static final boolean CHECKFORUPDATES_DEFAULT = true;
	public static final boolean SILENCEKNOWNUPDATES_DEFAULT = false;

	public static boolean checkForUpdates = CHECKFORUPDATES_DEFAULT;
	public static boolean silenceKnownUpdates = SILENCEKNOWNUPDATES_DEFAULT;

	private static Property propCheckForUpdates = null;
	private static Property propSilenceKnownUpdates = null;
	private static Property propKnownUpdates = null;

	public static void init(File configFile) {
		if (configuration == null) {
			configuration = new Configuration(configFile);
			loadConfiguration();
		}
	}

	private static void loadConfiguration() {
		propCheckForUpdates = configuration.get(CATEGORY_VERCHECK, CHECKFORUPDATES, CHECKFORUPDATES_DEFAULT, CHECKFORUPDATES_DESC);
		propCheckForUpdates.setLanguageKey(String.format("%s.%s", LANG_PREFIX, CHECKFORUPDATES));
		propCheckForUpdates.setRequiresMcRestart(true);
		checkForUpdates = propCheckForUpdates.getBoolean(CHECKFORUPDATES_DEFAULT);

		propSilenceKnownUpdates = configuration.get(CATEGORY_VERCHECK, SILENCEKNOWNUPDATES, SILENCEKNOWNUPDATES_DEFAULT, SILENCEKNOWNUPDATES_DESC);
		propSilenceKnownUpdates.setLanguageKey(String.format("%s.%s", LANG_PREFIX, SILENCEKNOWNUPDATES));
		propSilenceKnownUpdates.setRequiresMcRestart(true);
		silenceKnownUpdates = propSilenceKnownUpdates.getBoolean(SILENCEKNOWNUPDATES_DEFAULT);

		propKnownUpdates = configuration.get(CATEGORY_VERCHECK, KNOWNVERSIONS, new String[0], KNOWNVERSIONS_DESC);
		propKnownUpdates.setShowInGui(false);

		if (configuration.hasChanged()) {
			configuration.save();
		}
	}
{'fraction_non_alphanumeric': 0.07934485896269336, 'fraction_numerical': 0.0003639672429481347, 'mean_word_length': 6.907913669064748, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2145637', 'n_tokens_mistral': 1692, 'n_tokens_neox': 1617, 'n_words': 382}