use of com.loohp.yamlconfiguration.YamlConfiguration in project InteractiveChat by LOOHP.
the class CMLMain method validConfigs.
protected static void validConfigs() throws IOException {
File folder = new File("InteractiveChat");
if (!folder.exists() || !folder.isDirectory()) {
folder = new File("InteractiveChatBungee");
if (!folder.exists() || !folder.isDirectory()) {
System.out.println("Error: Plugin folder not found");
return;
}
}
Map<File, List<String>> results = new LinkedHashMap<>();
for (File file : folder.listFiles()) {
String fileName = file.getName();
if (fileName.endsWith(".yml")) {
YamlConfiguration yaml = new YamlConfiguration(new FileInputStream(file));
results.put(file, validateConfigurationSection("", yaml));
}
}
StringBuilder message = new StringBuilder("Validation Results: (Plugin Folder: " + folder.getAbsolutePath() + ")\n");
for (Entry<File, List<String>> entry : results.entrySet()) {
String fileName = entry.getKey().getName();
List<String> errors = entry.getValue();
message.append("\n").append(fileName).append(": ");
if (errors.isEmpty()) {
message.append("Valid!\n");
} else {
message.append("\n");
for (String error : errors) {
message.append(error).append("\n");
}
}
}
message.append("\nNote that a valid config doesn't mean REGEX are valid.");
System.out.println(message);
}
Aggregations