// Path: src/main/java/de/maxgb/minecraft/second_screen/util/Constants.java
// public class Constants {
// 
// 	public static final String MOD_ID = "maxanier_secondscreenmod";
// 	public static final String VERSION = "@VERSION@";
// 	public static final String MINECRAFT_VERSION = "@MVERSION@";
// 	public static final String NAME = "Second Screen Mod";
// 	public static final String UPDATE_FILE_LINK = "http://maxgb.de/minecraftsecondscreen/modversion.json";
// 
// 	/**
// 	 * Feature version for the client to know what feautures the modversion
// 	 * supports
// 	 */
// 	public static final int FEATURE_VERSION = 6;
// 
// 	public static final String USER_SAVE_DIR = "mss-users";
// 
// 	public static final String OBSERVER_FILE_NAME = "observer.json";
// 
// 	public static final String GUI_FACTORY_CLASS = "de.maxgb.minecraft.second_screen.client.gui.ModGuiFactory";
// 
// }
// 
// Path: src/main/java/de/maxgb/minecraft/second_screen/util/Logger.java
// public class Logger {
// 
// 	public static void d(String tag, String msg) {
// 		if(Configs.debug_mode){
// 			log(Level.INFO, "[" + tag + "]" + msg);
// 		}
// 
// 	}
// 
// 	public static void e(String tag, String msg) {
// 		log(Level.ERROR, "[" + tag + "]" + msg);
// 	}
// 
// 	public static void e(String tag, String msg, Throwable t) {
// 		String stacktrace = "";
// 		
// 		PrintStream p;
// 		try {
// 			p = new PrintStream(stacktrace);
// 			t.printStackTrace(p);
// 		} catch (FileNotFoundException e1) {
// 			stacktrace = t.getMessage();
// 		}
// 		log(Level.ERROR, "[" + tag + "]" + msg + "\nThrowable: "+t.getClass().getCanonicalName()+"\nStacktrace: " + stacktrace+"\nMessage: "+t.getMessage());
// 	}
// 
// 
// 	public static void i(String tag, String msg) {
// 		log(Level.INFO, "[" + tag + "]" + msg);
// 	}
// 
// 
// 	private static void log(Level level, String msg) {
// 		FMLLog.log(Constants.MOD_ID, level, msg);
// 	}
// 
// 	public static void w(String tag, String msg) {
// 		log(Level.WARN, "[" + tag + "]" + msg);
// 
// 	}
// }


import de.maxgb.minecraft.second_screen.util.Constants;
import de.maxgb.minecraft.second_screen.util.Logger;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
		loadConfiguration();

	}

	/**
	 * Loads/refreshes the configuration and adds comments if there aren't any
	 * {@link #init(File) init} has to be called once before using this
	 */
	public static void loadConfiguration() {

		// Categegories
		ConfigCategory update_times = config.getCategory(CATEGORY_UPDATE_TIMES);
		update_times
				.setComment("How often are the information updated (Measured in ServerTicks, just try out some values).");
		ConfigCategory con = config.getCategory(CATEGORY_CONNECTION_SETTINGS);
		con.setComment("On what Ip and port should the mod listen");

		// Connection settings
		try {
			hostname = config.get(con.getQualifiedName(), "hostname", InetAddress.getLocalHost().getHostAddress())
					.getString();
		} catch (UnknownHostException e) {
			Logger.e(TAG, "Failed to retrieve host address" + e);
			hostname = "localhost";
		}
		port = config.get(con.getQualifiedName(), "port", 25566).getInt();

		// Update times
		Property prop = config.get(update_times.getQualifiedName(), "server_info_update_time", 500);
        prop.setComment("General server info");
// Path: src/main/java/de/maxgb/minecraft/second_screen/util/Constants.java
// public class Constants {
// 
// 	public static final String MOD_ID = "maxanier_secondscreenmod";
// 	public static final String VERSION = "@VERSION@";
// 	public static final String MINECRAFT_VERSION = "@MVERSION@";
// 	public static final String NAME = "Second Screen Mod";
// 	public static final String UPDATE_FILE_LINK = "http://maxgb.de/minecraftsecondscreen/modversion.json";
// 
// 	/**
// 	 * Feature version for the client to know what feautures the modversion
// 	 * supports
// 	 */
// 	public static final int FEATURE_VERSION = 6;
// 
// 	public static final String USER_SAVE_DIR = "mss-users";
// 
// 	public static final String OBSERVER_FILE_NAME = "observer.json";
// 
// 	public static final String GUI_FACTORY_CLASS = "de.maxgb.minecraft.second_screen.client.gui.ModGuiFactory";
// 
// }
// 
// Path: src/main/java/de/maxgb/minecraft/second_screen/util/Logger.java
// public class Logger {
// 
// 	public static void d(String tag, String msg) {
// 		if(Configs.debug_mode){
// 			log(Level.INFO, "[" + tag + "]" + msg);
// 		}
// 
// 	}
// 
// 	public static void e(String tag, String msg) {
// 		log(Level.ERROR, "[" + tag + "]" + msg);
// 	}
// 
// 	public static void e(String tag, String msg, Throwable t) {
// 		String stacktrace = "";
// 		
// 		PrintStream p;
// 		try {
// 			p = new PrintStream(stacktrace);
// 			t.printStackTrace(p);
// 		} catch (FileNotFoundException e1) {
// 			stacktrace = t.getMessage();
// 		}
// 		log(Level.ERROR, "[" + tag + "]" + msg + "\nThrowable: "+t.getClass().getCanonicalName()+"\nStacktrace: " + stacktrace+"\nMessage: "+t.getMessage());
// 	}
// 
// 
// 	public static void i(String tag, String msg) {
// 		log(Level.INFO, "[" + tag + "]" + msg);
// 	}
// 
// 
// 	private static void log(Level level, String msg) {
// 		FMLLog.log(Constants.MOD_ID, level, msg);
// 	}
// 
// 	public static void w(String tag, String msg) {
// 		log(Level.WARN, "[" + tag + "]" + msg);
// 
// 	}
// }


// Path: src/main/java/de/maxgb/minecraft/second_screen/Configs.java
import de.maxgb.minecraft.second_screen.util.Constants;
import de.maxgb.minecraft.second_screen.util.Logger;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;

		loadConfiguration();

	}

	/**
	 * Loads/refreshes the configuration and adds comments if there aren't any
	 * {@link #init(File) init} has to be called once before using this
	 */
	public static void loadConfiguration() {

		// Categegories
		ConfigCategory update_times = config.getCategory(CATEGORY_UPDATE_TIMES);
		update_times
				.setComment("How often are the information updated (Measured in ServerTicks, just try out some values).");
		ConfigCategory con = config.getCategory(CATEGORY_CONNECTION_SETTINGS);
		con.setComment("On what Ip and port should the mod listen");

		// Connection settings
		try {
			hostname = config.get(con.getQualifiedName(), "hostname", InetAddress.getLocalHost().getHostAddress())
					.getString();
		} catch (UnknownHostException e) {
			Logger.e(TAG, "Failed to retrieve host address" + e);
			hostname = "localhost";
		}
		port = config.get(con.getQualifiedName(), "port", 25566).getInt();

		// Update times
		Property prop = config.get(update_times.getQualifiedName(), "server_info_update_time", 500);
        prop.setComment("General server info");
        server_info_update_time = prop.getInt();