mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-25 15:35:11 +01:00
Cleaned up configs
This commit is contained in:
parent
7b9fca999d
commit
7a444e4d87
@ -45,9 +45,8 @@ public class EcoEnchantsConfigs {
|
|||||||
* @param permissionName The permission name to match.
|
* @param permissionName The permission name to match.
|
||||||
* @return The matching {@link EnchantmentConfig}.
|
* @return The matching {@link EnchantmentConfig}.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
|
||||||
public EnchantmentConfig getEnchantmentConfig(@NotNull final String permissionName) {
|
public EnchantmentConfig getEnchantmentConfig(@NotNull final String permissionName) {
|
||||||
return enchantmentConfigs.stream().filter(config -> config.getName().equalsIgnoreCase(permissionName)).findFirst().get();
|
return enchantmentConfigs.stream().filter(config -> config.getName().equalsIgnoreCase(permissionName)).findFirst().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,18 +31,13 @@ public abstract class EnchantmentYamlConfig extends PluginDependent implements V
|
|||||||
* The internal config that stores the values.
|
* The internal config that stores the values.
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private YamlConfiguration config;
|
private final YamlConfiguration config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The physical file of the config.
|
* The physical file of the config.
|
||||||
*/
|
*/
|
||||||
@Getter(AccessLevel.PROTECTED)
|
@Getter(AccessLevel.PROTECTED)
|
||||||
private File configFile;
|
private final File configFile;
|
||||||
|
|
||||||
/**
|
|
||||||
* The directory that the config is in.
|
|
||||||
*/
|
|
||||||
private final File directory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The provider of the config.
|
* The provider of the config.
|
||||||
@ -78,13 +73,12 @@ public abstract class EnchantmentYamlConfig extends PluginDependent implements V
|
|||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
}
|
}
|
||||||
this.directory = dir;
|
|
||||||
|
|
||||||
if (!new File(directory, name + ".yml").exists()) {
|
if (!new File(dir, name + ".yml").exists()) {
|
||||||
createFile();
|
createFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.configFile = new File(directory, name + ".yml");
|
this.configFile = new File(dir, name + ".yml");
|
||||||
this.config = YamlConfiguration.loadConfiguration(configFile);
|
this.config = YamlConfiguration.loadConfiguration(configFile);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
Loading…
Reference in New Issue
Block a user