diff --git a/src/main/java/net/knarcraft/blacksmith/config/GlobalSetting.java b/src/main/java/net/knarcraft/blacksmith/config/GlobalSetting.java index 4405ee3..82fd8d8 100644 --- a/src/main/java/net/knarcraft/blacksmith/config/GlobalSetting.java +++ b/src/main/java/net/knarcraft/blacksmith/config/GlobalSetting.java @@ -23,9 +23,9 @@ public enum GlobalSetting { /** * The price increase for each level of each present enchantment * - *

This can be specified for each possible enchantment by setting enchantment-modifiers.enchantment_name

+ *

This can be specified for each possible enchantment by setting enchantment-cost.enchantment_name

*/ - ENCHANTMENT_MODIFIER("global.enchantment-cost.default", 5), + ENCHANTMENT_COST("global.enchantment-cost.default", 5), /** * Whether the cost should increase for damage taken, as opposed to increase for durability present diff --git a/src/main/java/net/knarcraft/blacksmith/config/GlobalSettings.java b/src/main/java/net/knarcraft/blacksmith/config/GlobalSettings.java index dc0c9eb..89c2119 100644 --- a/src/main/java/net/knarcraft/blacksmith/config/GlobalSettings.java +++ b/src/main/java/net/knarcraft/blacksmith/config/GlobalSettings.java @@ -19,7 +19,7 @@ public class GlobalSettings { private final Map materialBasePrices = new HashMap<>(); private final Map materialPricePerDurabilityPoints = new HashMap<>(); - private final Map enchantmentModifiers = new HashMap<>(); + private final Map enchantmentCosts = new HashMap<>(); private final Map defaultNPCSettings = new HashMap<>(); private final Map globalSettings = new HashMap<>(); @@ -50,7 +50,7 @@ public class GlobalSettings { globalSettings.clear(); materialBasePrices.clear(); materialPricePerDurabilityPoints.clear(); - enchantmentModifiers.clear(); + enchantmentCosts.clear(); //Load/Save NPC default settings loadDefaultNPCSettings(root); @@ -118,11 +118,11 @@ public class GlobalSettings { * @param enchantment

The enchantment to get the cost for

* @return

The cost of each enchantment level

*/ - public double getEnchantmentModifier(Enchantment enchantment) { - if (enchantmentModifiers.containsKey(enchantment) && enchantmentModifiers.get(enchantment) != null) { - return enchantmentModifiers.get(enchantment); + public double getEnchantmentCost(Enchantment enchantment) { + if (enchantmentCosts.containsKey(enchantment) && enchantmentCosts.get(enchantment) != null) { + return enchantmentCosts.get(enchantment); } else { - return asDouble(GlobalSetting.ENCHANTMENT_MODIFIER); + return asDouble(GlobalSetting.ENCHANTMENT_COST); } } @@ -202,7 +202,7 @@ public class GlobalSettings { if (material != null) { materialBasePrices.put(material, basePriceNode.getDouble(key)); } else { - BlacksmithPlugin.getInstance().getLogger().log(Level.WARNING, + BlacksmithPlugin.getInstance().getLogger().log(Level.WARNING, "Unable to find a material matching " + materialName); } } @@ -216,21 +216,21 @@ public class GlobalSettings { if (material != null) { materialPricePerDurabilityPoints.put(material, basePerDurabilityPriceNode.getDouble(key)); } else { - BlacksmithPlugin.getInstance().getLogger().log(Level.WARNING, + BlacksmithPlugin.getInstance().getLogger().log(Level.WARNING, "Unable to find a material matching " + materialName); } } //Load all enchantment prices - DataKey enchantmentModifiersNode = root.getRelative(GlobalSetting.ENCHANTMENT_MODIFIER.getParent()); + DataKey enchantmentCostNode = root.getRelative(GlobalSetting.ENCHANTMENT_COST.getParent()); relevantKeys = getRelevantKeys(basePerDurabilityPriceNode); for (String key : relevantKeys.keySet()) { String enchantmentName = relevantKeys.get(key); Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(enchantmentName)); if (enchantment != null) { - enchantmentModifiers.put(enchantment, enchantmentModifiersNode.getDouble(key)); + enchantmentCosts.put(enchantment, enchantmentCostNode.getDouble(key)); } else { - BlacksmithPlugin.getInstance().getLogger().log(Level.WARNING, + BlacksmithPlugin.getInstance().getLogger().log(Level.WARNING, "Unable to find an enchantment matching " + enchantmentName); } } diff --git a/src/main/java/net/knarcraft/blacksmith/manager/EconomyManager.java b/src/main/java/net/knarcraft/blacksmith/manager/EconomyManager.java index 9700bf0..567c252 100644 --- a/src/main/java/net/knarcraft/blacksmith/manager/EconomyManager.java +++ b/src/main/java/net/knarcraft/blacksmith/manager/EconomyManager.java @@ -147,7 +147,7 @@ public class EconomyManager { GlobalSettings settings = BlacksmithPlugin.getInstance().getSettings(); double price = 0; for (Enchantment enchantment : item.getEnchantments().keySet()) { - price += settings.getEnchantmentModifier(enchantment) * item.getEnchantmentLevel(enchantment); + price += settings.getEnchantmentCost(enchantment) * item.getEnchantmentLevel(enchantment); } return price; }