Préparation des données de configuration
This commit is contained in:
parent
49246f233e
commit
f9a49ff2ee
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<jardesc>
|
||||
<jar path="PandacraftUtils/jar_export/PandacraftUtils-2.7.jar"/>
|
||||
<jar path="PandacraftUtils/jar_export/PandacraftUtils-2.8.jar"/>
|
||||
<options buildIfNeeded="true" compress="true" descriptionLocation="/PandacraftUtils/make_jar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||
<selectedProjects/>
|
||||
|
28
resources/config.yml
Normal file
28
resources/config.yml
Normal file
@ -0,0 +1,28 @@
|
||||
database:
|
||||
host: localhost
|
||||
port: 3306
|
||||
base: pandacraft
|
||||
user: pandacraft
|
||||
pass: HYtKq92pfx9ucwzq
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
afk:
|
||||
# in seconds
|
||||
timeoutAutoMessage: 300
|
||||
timeoutAutoKick: 600
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
chatAnalysis:
|
||||
# in miliseconds
|
||||
timeBeforeResendSameMessage: 120000
|
||||
timeBeforeResendSameCommand: 60000
|
||||
timePerCaracterForNewMessage: 100
|
||||
maxViolationLevel: 20
|
||||
nbSecondForOneVLDown: 10
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: PandacraftUtils
|
||||
main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils
|
||||
version: 2.7
|
||||
version: 2.8
|
||||
|
||||
|
||||
|
||||
|
@ -1,28 +1,82 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
/*
|
||||
* Configuration du plugin
|
||||
*/
|
||||
public class ConfigManager {
|
||||
private static ConfigManager instance = null;
|
||||
|
||||
public static ConfigManager getInstance() {
|
||||
public synchronized static ConfigManager getInstance() {
|
||||
|
||||
if (instance == null)
|
||||
instance = new ConfigManager();
|
||||
try {
|
||||
instance = new ConfigManager();
|
||||
} catch (Exception e) {
|
||||
PandacraftUtils.getInstance().getLogger().severe("Erreur de chargement de la configuration de PandacraftUtils");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public synchronized static void reloadConfig() {
|
||||
instance = null;
|
||||
}
|
||||
|
||||
private PandacraftUtils plugin = PandacraftUtils.getInstance();
|
||||
|
||||
private ConfigManager() {
|
||||
private ConfigManager() throws Exception {
|
||||
|
||||
// dossier de configuration principale
|
||||
File configDir = plugin.getDataFolder();
|
||||
configDir.mkdir();
|
||||
|
||||
// dossier qui doit contenir les messages automatiques
|
||||
File autoMessagesDir = new File(configDir, "automessages");
|
||||
autoMessagesDir.mkdir();
|
||||
|
||||
// dossier qui doit contenir les alias de commandes
|
||||
File commandAliasDir = new File(configDir, "commandalias");
|
||||
commandAliasDir.mkdir();
|
||||
|
||||
// dossier qui doit contenir les séries de commandes
|
||||
File multiCommandsDir = new File(configDir, "multicommands");
|
||||
multiCommandsDir.mkdir();
|
||||
|
||||
// fichier qui doit contenir les insultes à censurer
|
||||
File badWordsFile = new File(configDir, "badwords.txt");
|
||||
badWordsFile.createNewFile();
|
||||
|
||||
plugin.saveDefaultConfig();
|
||||
FileConfiguration configFile = plugin.getConfig();
|
||||
|
||||
|
||||
Database_host = configFile.getString("database.host");
|
||||
Database_port = configFile.getInt("database.port");
|
||||
Database_database = configFile.getString("database.base");
|
||||
Database_username = configFile.getString("database.user");
|
||||
Database_password = configFile.getString("database.pass");
|
||||
|
||||
AFK_timeoutAutoAfkMessage = configFile.getInt("afk.timeoutAutoMessage");
|
||||
AFK_timeoutAutoAfkKick = configFile.getInt("afk.timeoutAutoKick");
|
||||
|
||||
|
||||
|
||||
ChatAnalysis_timeBeforeResendSameMessage = configFile.getLong("chatAnalysis.timeBeforeResendSameMessage");
|
||||
ChatAnalysis_timeBeforeResendSameCommand = configFile.getLong("chatAnalysis.timeBeforeResendSameCommand");
|
||||
ChatAnalysis_timePerCaracterForNewMessage = configFile.getLong("chatAnalysis.timePerCaracterForNewMessage");
|
||||
ChatAnalysis_maxViolationLevel = configFile.getInt("chatAnalysis.maxViolationLevel");
|
||||
ChatAnalysis_nbSecondForOneVLDown = configFile.getInt("chatAnalysis.nbSecondForOneVLDown");
|
||||
|
||||
|
||||
|
||||
|
||||
initChatAnalysisBadWord();
|
||||
@ -35,11 +89,11 @@ public class ConfigManager {
|
||||
* 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";
|
||||
public String Database_host;
|
||||
public int Database_port;
|
||||
public String Database_username;
|
||||
public String Database_database;
|
||||
public String Database_password;
|
||||
|
||||
|
||||
|
||||
@ -51,9 +105,14 @@ public class ConfigManager {
|
||||
/*
|
||||
* Configuration AFK
|
||||
*/
|
||||
|
||||
public int AFK_timeoutAutoAfkMessage = 60*5; // 5 min
|
||||
public int AFK_timeoutAutoAfkKick = 60*10; // 10 min
|
||||
/**
|
||||
* En secondes
|
||||
*/
|
||||
public int AFK_timeoutAutoAfkMessage;
|
||||
/**
|
||||
* En secondes
|
||||
*/
|
||||
public int AFK_timeoutAutoAfkKick; // 10 min
|
||||
|
||||
|
||||
|
||||
@ -62,12 +121,24 @@ public class ConfigManager {
|
||||
* Configuration analyse du chat et des messages privés
|
||||
* (antispam, insultes, publicité)
|
||||
*/
|
||||
|
||||
/**
|
||||
* En milisecondes
|
||||
*/
|
||||
public long ChatAnalysis_timeBeforeResendSameMessage;// 2 min
|
||||
/**
|
||||
* En milisecondes
|
||||
*/
|
||||
public long ChatAnalysis_timeBeforeResendSameCommand;// 60 sec
|
||||
/**
|
||||
* En milisecondes
|
||||
*/
|
||||
public long ChatAnalysis_timePerCaracterForNewMessage;// 0.1 sec
|
||||
public int ChatAnalysis_maxViolationLevel;
|
||||
public int ChatAnalysis_nbSecondForOneVLDown;
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
@ -4,8 +4,6 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.Essentials
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.earth2me.essentials.Essentials;
|
||||
|
||||
public class AfkPlayer {
|
||||
private Player player;
|
||||
private long timeLastAction;
|
||||
|
Loading…
Reference in New Issue
Block a user