use of org.bukkit.configuration.file.YamlConfiguration in project EliteMobs by MagmaGuy.
the class CustomConfigLoader method reloadCustomConfig.
public void reloadCustomConfig(String configName) {
if (customConfigFile == null) {
customConfigFile = new File(plugin.getDataFolder(), configName);
}
customConfig = YamlConfiguration.loadConfiguration(customConfigFile);
// Look for defaults in the jar
Reader defConfigStream = null;
try {
defConfigStream = new InputStreamReader(plugin.getResource(configName), "UTF8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
if (defConfigStream != null) {
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(customConfigFile);
customConfig.setDefaults(defConfig);
}
}
use of org.bukkit.configuration.file.YamlConfiguration in project TotalFreedomMod by TotalFreedom.
the class MainConfig method load.
public void load() {
try {
YamlConfiguration config = new YamlConfiguration();
config.load(getConfigFile());
for (ConfigEntry entry : ConfigEntry.values()) {
String path = entry.getConfigName();
if (config.contains(path)) {
Object value = config.get(path);
if (value == null || entry.getType().isAssignableFrom(value.getClass())) {
entries.put(entry, value);
} else {
FLog.warning("Value for " + entry.getConfigName() + " is of type " + value.getClass().getSimpleName() + ". Needs to be " + entry.getType().getSimpleName() + ". Using default value.");
}
} else {
FLog.warning("Missing configuration entry " + entry.getConfigName() + ". Using default value.");
}
}
} catch (IOException | InvalidConfigurationException ex) {
FLog.severe(ex);
}
}
use of org.bukkit.configuration.file.YamlConfiguration in project GameCore by Warvale.
the class ConfigManager method reloadLobby.
public void reloadLobby() {
try {
lobby = new YamlConfiguration();
lobby.load(lobbyFile);
} catch (Exception ex) {
Main.get().getLogger().severe("Could not reload config: " + lobbyFile.getName());
}
}
use of org.bukkit.configuration.file.YamlConfiguration in project GameCore by Warvale.
the class ConfigManager method reloadConfig.
public void reloadConfig() {
try {
config = new YamlConfiguration();
config.load(configFile);
} catch (Exception ex) {
Main.get().getLogger().severe("Could not reload config: " + configFile.getName());
}
}
use of org.bukkit.configuration.file.YamlConfiguration in project GameCore by Warvale.
the class ConfigManager method reloadMessages.
public void reloadMessages() {
try {
messages = new YamlConfiguration();
messages.load(messageFile);
} catch (Exception ex) {
Main.get().getLogger().severe("Could not reload config: " + messageFile.getName());
}
}
Aggregations