use of org.bukkit.configuration.file.FileConfiguration in project Denizen-For-Bukkit by DenizenScript.
the class EntityScriptHelper method saveEntities.
public static void saveEntities() {
FileConfiguration entityScripts = DenizenAPI.getCurrentInstance().getEntities();
entityScripts.set("entities.scripts", null);
for (Map.Entry<UUID, String> entry : entities.entrySet()) {
entityScripts.set("entities.scripts." + entry.getKey() + ".scriptname", entry.getValue());
}
}
use of org.bukkit.configuration.file.FileConfiguration in project AuthMeReloaded by AuthMe.
the class TranslationsGatherer method processMessagesFile.
private void processMessagesFile(String code, File file) {
FileConfiguration configuration = YamlConfiguration.loadConfiguration(file);
int availableMessages = 0;
for (MessageKey key : MessageKey.values()) {
if (configuration.contains(key.getKey())) {
++availableMessages;
}
}
translationInfo.add(new TranslationInfo(code, (double) availableMessages / MessageKey.values().length));
}
use of org.bukkit.configuration.file.FileConfiguration in project AuthMeReloaded by AuthMe.
the class GeneratePluginYml method executeDefault.
@Override
public void executeDefault() {
FileConfiguration configuration = loadPartialPluginYmlFile();
configuration.set("commands", generateCommands());
configuration.set("permissions", generatePermissions());
FileIoUtils.writeToFile(PLUGIN_YML_FILE, pluginYmlStart + "\n" + configuration.saveToString());
}
use of org.bukkit.configuration.file.FileConfiguration in project AuthMeReloaded by AuthMe.
the class CodeClimateConfigTest method shouldHaveExistingClassesInExclusions.
@Test
public void shouldHaveExistingClassesInExclusions() {
// given
FileConfiguration configuration = YamlConfiguration.loadConfiguration(new File(CONFIG_FILE));
List<String> excludePaths = configuration.getStringList("exclude_paths");
// when / then
assertThat(excludePaths, not(empty()));
for (String path : excludePaths) {
String className = convertPathToQualifiedClassName(path);
assertThat("No class corresponds to excluded path '" + path + "'", Utils.isClassLoaded(className), equalTo(true));
}
}
use of org.bukkit.configuration.file.FileConfiguration in project AuthMeReloaded by AuthMe.
the class MessageUpdater method loadJarFileOrSendError.
private static FileConfiguration loadJarFileOrSendError(String jarPath) {
try (InputStream stream = FileUtils.getResourceFromJar(jarPath)) {
if (stream == null) {
ConsoleLogger.info("Could not load '" + jarPath + "' from JAR");
return null;
}
InputStreamReader isr = new InputStreamReader(stream);
FileConfiguration configuration = YamlConfiguration.loadConfiguration(isr);
close(isr);
return configuration;
} catch (IOException e) {
ConsoleLogger.logException("Exception while handling JAR path '" + jarPath + "'", e);
}
return null;
}
Aggregations