Amélioration mineure de la gestion des fichiers de configuration

This commit is contained in:
Marc Baloup 2016-08-18 14:42:38 +02:00
parent df696d99a3
commit 9752ff311e
2 changed files with 15 additions and 2 deletions

View File

@ -6,9 +6,11 @@ import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import fr.pandacube.java.util.Log; import fr.pandacube.java.util.Log;
import net.md_5.bungee.api.ChatColor;
/** /**
* Classe chargeant en mémoire un fichier de configuration ou un dossier donné * Classe chargeant en mémoire un fichier de configuration ou un dossier donné
* @author Marc Baloup * @author Marc Baloup
@ -110,13 +112,24 @@ public abstract class AbstractConfig {
if (perms == null || perms.equals("*")) if (perms == null || perms.equals("*"))
return null; return null;
else else
return Arrays.asList(perms.split(";")); return getSplittedString(perms, ";");
} }
public static List<String> getSplittedString(String value, String split) {
return Collections.unmodifiableList(Arrays.asList(value.split(split)));
}
public static String getTranslatedColorCode(String string) {
return ChatColor.translateAlternateColorCodes('&', string);
}
protected void warning(String message) { protected void warning(String message) {

View File

@ -5,7 +5,7 @@ import java.io.IOException;
public abstract class AbstractConfigManager { public abstract class AbstractConfigManager {
protected File configDir; protected final File configDir;
public AbstractConfigManager(File configD) throws IOException { public AbstractConfigManager(File configD) throws IOException {
configDir = configD; configDir = configD;