diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSet.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSet.java index a7f3689..de38186 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSet.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/ArmorSet.java @@ -126,16 +126,10 @@ public class ArmorSet { this.plugin = plugin; this.name = config.getString("name"); - for (String definedKey : this.getConfig().getStrings("conditions")) { - String[] split = definedKey.split(":"); - String key = split[0].trim(); - String value = split[1].trim(); - Condition condition = Conditions.getByName(key); - if (condition == null) { - Bukkit.getLogger().warning("Invalid condition specified in " + this.name); - } else { - conditions.put(condition, ArmorUtils.getConditionValue(value, condition)); - } + for (JSONConfig cfg : this.getConfig().getSubsections("conditions")) { + Condition effect = Conditions.getByName(cfg.getString("id")); + Object value = cfg.get("args"); + conditions.put(effect, value); } for (JSONConfig cfg : this.getConfig().getSubsections("effects")) { diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/util/ArmorUtils.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/util/ArmorUtils.java index 5f339d7..e7a66ec 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/util/ArmorUtils.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoarmor/sets/util/ArmorUtils.java @@ -401,30 +401,4 @@ public class ArmorUtils { return ArmorSets.getByName(shardSet); } - - /** - * Get value of condition. - * - * @param string Value as string. - * @param condition Condition. - * @param The type of the condition. - * @return Value. - */ - @NotNull - public static Object getConditionValue(@NotNull final String string, - @NotNull final Condition condition) { - if (condition.getTypeClass().equals(Boolean.class)) { - return Boolean.parseBoolean(string); - } - - if (condition.getTypeClass().equals(Integer.class)) { - return Integer.parseInt(string); - } - - if (condition.getTypeClass().equals(Double.class)) { - return Double.parseDouble(string); - } - - return string; - } }