package net.mc_pandacraft.java.plugin.pandacraftutils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/*
 * Configuration du plugin
 */
public class ConfigManager {
	private static ConfigManager instance = null;
	
	public static ConfigManager getInstance() {
		
		if (instance == null)
			instance = new ConfigManager();
		
		return instance;
	}
	
	@SuppressWarnings("unused")
	private PandacraftUtils plugin = PandacraftUtils.getInstance();
	
	private ConfigManager() {
		
		
		initChatAnalysisBadWord();
		initCommandAlias();
	}
	
	
	
	/*
	 * Connexion à la base de donnée
	 */
	
	public String Database_host = "localhost";
	public int Database_port = 3306;
	public String Database_username = "pandacraft";
	public String Database_database = "pandacraft";
	public String Database_password = "HYtKq92pfx9ucwzq";
	
	
	
	
	
	
	
	
	/*
	 * Configuration AFK
	 */
	
	public int AFK_timeoutAutoAfkMessage = 60*5; // 5 min
	public int AFK_timeoutAutoAfkKick = 60*10; // 10 min
	
	
	
	
	/*
	 * Configuration analyse du chat et des messages privés
	 * (antispam, insultes, publicité)
	 */
	
	public long ChatAnalysis_timeBeforeResendSameMessage = 120000;// 2 min
	public long ChatAnalysis_timeBeforeResendSameCommand = 60000;// 60 sec
	public long ChatAnalysis_timePerCaracterForNewMessage = 100;// 0.1 sec
	public int ChatAnalysis_maxViolationLevel = 20;
	public int ChatAnalysis_nbSecondForOneVLDown = 10;
	
	public List<String> ChatAnalysis_badWords;	// les insultes
	
	private void initChatAnalysisBadWord() {
		ChatAnalysis_badWords = new ArrayList<String>();
		
		/*
		 * Insultes
		 */
		ChatAnalysis_badWords.add("pu+tes?");
		ChatAnalysis_badWords.add("conn?a(rd?|ss?e?)");
		ChatAnalysis_badWords.add("sal(o+|au)pe?s?");
		ChatAnalysis_badWords.add("[ea]ncul(é|e|er|ai(s|t|))");
		ChatAnalysis_badWords.add("merdes?");
		ChatAnalysis_badWords.add("ni(qu|k)e? ta m(è|e|é)re?");
		ChatAnalysis_badWords.add("fil?s de putes?");
		ChatAnalysis_badWords.add("ta m(è|e|é)re? l(a|e) putes?");
		ChatAnalysis_badWords.add("tafiole?s?");
		ChatAnalysis_badWords.add("vas? te pendre");
		ChatAnalysis_badWords.add("fuck");
		ChatAnalysis_badWords.add("mother ?fuc?ker");
		ChatAnalysis_badWords.add("dick");
		ChatAnalysis_badWords.add("ass");
		ChatAnalysis_badWords.add("bitch");
		//ChatAnalysis_badWords.add("");
		
		
		/*
		 * Pub pour des serveurs (avec sous domaines type *.mtxserv.fr ou nom de serveur connu genre Minefield)
		 */
		ChatAnalysis_badWords.add("minefield");
		ChatAnalysis_badWords.add("mineplex");
		ChatAnalysis_badWords.add("hypixel");
		//ChatAnalysis_badWords.add("");
		//ChatAnalysis_badWords.add("");
		//ChatAnalysis_badWords.add("");
	}
	
	
	
	
	
	
	
	
	
	/*
	 * Alias pour les commandes
	 */
	
	public List<Map<String, String>> CommandAlias_alias;
	
	private void initCommandAlias() {
		CommandAlias_alias = new ArrayList<Map<String, String>>();
		Map<String, String> alias;
		
		
		alias = new HashMap<String, String>();
		alias.put("initialCommand", "/day");
		alias.put("replaceWith", "/ptime day");
		alias.put("permissions", "pandacraft.grade.users"); // multiple permission separated with semicolumn
		CommandAlias_alias.add(alias);
		
		alias = new HashMap<String, String>();
		alias.put("initialCommand", "/night");
		alias.put("replaceWith", "/ptime night");
		alias.put("permissions", "pandacraft.grade.users");
		CommandAlias_alias.add(alias);
		
		alias = new HashMap<String, String>();
		alias.put("initialCommand", "/time");
		alias.put("replaceWith", "/ptime");
		alias.put("permissions", "pandacraft.grade.users");
		CommandAlias_alias.add(alias);
		/*
		Map<String, String> alias = new HashMap<String, String>();
		alias.put("initialCommand", "");
		alias.put("replaceWith", "");
		alias.put("permissions", "");
		CommandAlias_alias.add(alias);
		*/
	}
	
	
}
