mirror of
https://github.com/essentials/Essentials.git
synced 2025-10-02 17:16:59 +02:00
Update all code formatting to use tabs for indentation.
This commit is contained in:
@@ -13,81 +13,89 @@ import org.anjocaido.groupmanager.utils.Tasks;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author gabrielcouto
|
||||
*/
|
||||
public class GMConfiguration {
|
||||
|
||||
private GroupManager plugin;
|
||||
private File configFile;
|
||||
private YamlConfiguration GMconfig;
|
||||
|
||||
public GMConfiguration(GroupManager plugin) {
|
||||
this.plugin = plugin;
|
||||
load();
|
||||
}
|
||||
private GroupManager plugin;
|
||||
private File configFile;
|
||||
private YamlConfiguration GMconfig;
|
||||
|
||||
public void load() {
|
||||
if (!plugin.getDataFolder().exists()) {
|
||||
plugin.getDataFolder().mkdirs();
|
||||
}
|
||||
configFile = new File(plugin.getDataFolder(), "config.yml");
|
||||
public GMConfiguration(GroupManager plugin) {
|
||||
|
||||
if (!configFile.exists()) {
|
||||
try {
|
||||
Tasks.copy(plugin.getResourceAsStream("config.yml"), configFile);
|
||||
} catch (IOException ex) {
|
||||
GroupManager.logger.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
this.plugin = plugin;
|
||||
load();
|
||||
}
|
||||
|
||||
GMconfig = new YamlConfiguration();
|
||||
|
||||
try {
|
||||
GMconfig.load(configFile);
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex);
|
||||
}
|
||||
|
||||
// Setup defaults
|
||||
adjustLoggerLevel();
|
||||
plugin.setValidateOnlinePlayer(isToggleValidate());
|
||||
}
|
||||
|
||||
public boolean isOpOverride() {
|
||||
return GMconfig.getBoolean("settings.config.opOverrides", true);
|
||||
}
|
||||
public boolean isToggleValidate() {
|
||||
return GMconfig.getBoolean("settings.config.validate_toggle", true);
|
||||
}
|
||||
public void load() {
|
||||
|
||||
public Map<String, Object> getMirrorsMap() {
|
||||
// Try to fetch the old mirror path first
|
||||
if (!plugin.getDataFolder().exists()) {
|
||||
plugin.getDataFolder().mkdirs();
|
||||
}
|
||||
configFile = new File(plugin.getDataFolder(), "config.yml");
|
||||
|
||||
if (!configFile.exists()) {
|
||||
try {
|
||||
Tasks.copy(plugin.getResourceAsStream("config.yml"), configFile);
|
||||
} catch (IOException ex) {
|
||||
GroupManager.logger.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
GMconfig = new YamlConfiguration();
|
||||
|
||||
try {
|
||||
GMconfig.load(configFile);
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex);
|
||||
}
|
||||
|
||||
// Setup defaults
|
||||
adjustLoggerLevel();
|
||||
plugin.setValidateOnlinePlayer(isToggleValidate());
|
||||
}
|
||||
|
||||
public boolean isOpOverride() {
|
||||
|
||||
return GMconfig.getBoolean("settings.config.opOverrides", true);
|
||||
}
|
||||
|
||||
public boolean isToggleValidate() {
|
||||
|
||||
return GMconfig.getBoolean("settings.config.validate_toggle", true);
|
||||
}
|
||||
|
||||
public Map<String, Object> getMirrorsMap() {
|
||||
|
||||
// Try to fetch the old mirror path first
|
||||
if (GMconfig.isConfigurationSection("settings.permission.world.mirror")) {
|
||||
return (Map<String, Object>) GMconfig.getConfigurationSection("settings.permission.world.mirror").getValues(false);
|
||||
} else if (GMconfig.isConfigurationSection("settings.mirrors")){
|
||||
} else if (GMconfig.isConfigurationSection("settings.mirrors")) {
|
||||
return (Map<String, Object>) GMconfig.getConfigurationSection("settings.mirrors").getValues(false);
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public Integer getSaveInterval() {
|
||||
return GMconfig.getInt("settings.data.save.minutes", 10);
|
||||
}
|
||||
|
||||
public Integer getBackupDuration() {
|
||||
return GMconfig.getInt("settings.data.save.hours", 24);
|
||||
}
|
||||
}
|
||||
|
||||
public void adjustLoggerLevel() {
|
||||
|
||||
try {
|
||||
GroupManager.logger.setLevel(Level.parse(GMconfig.getString("settings.logging.level", "INFO")));
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
GroupManager.logger.setLevel(Level.INFO);
|
||||
}
|
||||
public Integer getSaveInterval() {
|
||||
|
||||
return GMconfig.getInt("settings.data.save.minutes", 10);
|
||||
}
|
||||
|
||||
public Integer getBackupDuration() {
|
||||
|
||||
return GMconfig.getInt("settings.data.save.hours", 24);
|
||||
}
|
||||
|
||||
public void adjustLoggerLevel() {
|
||||
|
||||
try {
|
||||
GroupManager.logger.setLevel(Level.parse(GMconfig.getString("settings.logging.level", "INFO")));
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
GroupManager.logger.setLevel(Level.INFO);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user