mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-13 23:11:20 +01:00
Removed redundant config classes and fixed package
This commit is contained in:
parent
3e9fcca246
commit
39f4353f44
@ -11,9 +11,8 @@ import com.willfp.ecoenchants.command.commands.CommandEcoreload;
|
||||
import com.willfp.ecoenchants.command.commands.CommandEnchantinfo;
|
||||
import com.willfp.ecoenchants.command.commands.CommandRandomenchant;
|
||||
import com.willfp.ecoenchants.command.tabcompleters.TabCompleterEnchantinfo;
|
||||
import com.willfp.ecoenchants.config.EcoEnchantsConfigs;
|
||||
import com.willfp.ecoenchants.config.configs.RarityYml;
|
||||
import com.willfp.ecoenchants.config.configs.TargetYml;
|
||||
import com.willfp.ecoenchants.config.RarityYml;
|
||||
import com.willfp.ecoenchants.config.TargetYml;
|
||||
import com.willfp.ecoenchants.display.EnchantDisplay;
|
||||
import com.willfp.ecoenchants.display.EnchantmentCache;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
@ -217,7 +216,6 @@ public class EcoEnchantsPlugin extends EcoPlugin {
|
||||
@Override
|
||||
public List<Class<?>> getUpdatableClasses() {
|
||||
return Arrays.asList(
|
||||
EcoEnchantsConfigs.class,
|
||||
EnchantmentCache.class,
|
||||
EnchantmentRarity.class,
|
||||
EnchantmentTarget.class,
|
||||
|
@ -1,46 +0,0 @@
|
||||
package com.willfp.ecoenchants.config;
|
||||
|
||||
import com.willfp.eco.core.config.ConfigUpdater;
|
||||
import com.willfp.ecoenchants.config.configs.EnchantmentConfig;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@UtilityClass
|
||||
public class EcoEnchantsConfigs {
|
||||
/**
|
||||
* All enchantment-specific configs.
|
||||
*/
|
||||
@Getter
|
||||
private final Set<EnchantmentConfig> enchantmentConfigs = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Update all configs.
|
||||
*/
|
||||
@ConfigUpdater
|
||||
public void updateConfigs() {
|
||||
enchantmentConfigs.forEach(EnchantmentConfig::update);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get EnchantmentConfig matching permission name.
|
||||
*
|
||||
* @param permissionName The permission name to match.
|
||||
* @return The matching {@link EnchantmentConfig}.
|
||||
*/
|
||||
public EnchantmentConfig getEnchantmentConfig(@NotNull final String permissionName) {
|
||||
return enchantmentConfigs.stream().filter(config -> config.getName().equalsIgnoreCase(permissionName)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds new enchantment config yml.
|
||||
*
|
||||
* @param config The config to add.
|
||||
*/
|
||||
public void addEnchantmentConfig(@NotNull final EnchantmentConfig config) {
|
||||
enchantmentConfigs.add(config);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.willfp.ecoenchants.config.configs;
|
||||
package com.willfp.ecoenchants.config;
|
||||
|
||||
import com.willfp.eco.core.config.ExtendableConfig;
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
@ -1,4 +1,4 @@
|
||||
package com.willfp.ecoenchants.config.configs;
|
||||
package com.willfp.ecoenchants.config;
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin;
|
||||
import com.willfp.eco.core.config.BaseConfig;
|
@ -1,4 +1,4 @@
|
||||
package com.willfp.ecoenchants.config.configs;
|
||||
package com.willfp.ecoenchants.config;
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin;
|
||||
import com.willfp.eco.core.config.BaseConfig;
|
@ -3,8 +3,7 @@ package com.willfp.ecoenchants.enchantments;
|
||||
import com.willfp.eco.core.Prerequisite;
|
||||
import com.willfp.eco.util.StringUtils;
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.config.EcoEnchantsConfigs;
|
||||
import com.willfp.ecoenchants.config.configs.EnchantmentConfig;
|
||||
import com.willfp.ecoenchants.config.EnchantmentConfig;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -142,8 +141,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche
|
||||
|
||||
this.type = type;
|
||||
this.permissionName = key.replace("_", "");
|
||||
EcoEnchantsConfigs.addEnchantmentConfig(new EnchantmentConfig(this.permissionName, this.getClass(), this.type));
|
||||
this.config = EcoEnchantsConfigs.getEnchantmentConfig(this.permissionName);
|
||||
this.config = new EnchantmentConfig(this.permissionName, this.getClass(), this.type);
|
||||
|
||||
if (Bukkit.getPluginManager().getPermission("ecoenchants.fromtable." + permissionName) == null) {
|
||||
Permission permission = new Permission(
|
||||
|
@ -3,7 +3,7 @@ package com.willfp.ecoenchants.enchantments.meta;
|
||||
import com.willfp.eco.core.config.ConfigUpdater;
|
||||
import com.willfp.eco.util.StringUtils;
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.config.configs.RarityYml;
|
||||
import com.willfp.ecoenchants.config.RarityYml;
|
||||
import lombok.Getter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
Loading…
Reference in New Issue
Block a user