diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceMining.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceMining.java index 088611b67..ff31b2f31 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceMining.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceMining.java @@ -100,6 +100,6 @@ public class ConfigExperienceMining { } @Setting(value = "Mining-Experience") - private HashMap miningExperienceMap; + private HashMap miningExperienceMap = MINING_EXPERIENCE_DEFAULT; } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java index e8133fb8b..0cfe7d98b 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceRepair.java @@ -1,8 +1,46 @@ package com.gmail.nossr50.config.hocon.experience; +import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory; +import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; +import java.util.HashMap; + @ConfigSerializable public class ConfigExperienceRepair { + private static final double REPAIR_XP_BASE_DEFAULT = 1000.0D; + + private static final HashMap ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; + + static { + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT = new HashMap<>(); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.WOOD.toString(), 0.6D); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STONE.toString(), 1.3D); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.IRON.toString(), 2.5D); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.GOLD.toString(), 0.3D); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.DIAMOND.toString(), 5.0D); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.LEATHER.toString(), 1.6D); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STRING.toString(), 1.8D); + ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.OTHER.toString(), 1.5D); + } + + private HashMap itemMaterialXPMultiplier = ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; + + @Setting(value = "Repair-XP-Base", comment = "The base amount of XP for repairing an item." + + "\nThe repair XP formula is a simple multiplication of these 4 values in this order" + + "\nThe amount repair (0.0 to 1.0)" + + "\nThe item XP multiplier defined in the Repair config" + + "\nThe Base Repair XP defined here (default 1000.0D)" + + "\nAnd finally, the XP multiplier of the item material category defined in this config." + + "\nDefault value: "+REPAIR_XP_BASE_DEFAULT) + private double repairXPBase = REPAIR_XP_BASE_DEFAULT; + + public HashMap getItemMaterialXPMultiplier() { + return itemMaterialXPMultiplier; + } + + public static double getRepairXpBaseDefault() { + return REPAIR_XP_BASE_DEFAULT; + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java index c133e9546..d3cfecb0a 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java @@ -160,7 +160,10 @@ public class RepairManager extends SkillManager { inventory.removeItem(toRemove); // Give out XP like candy - applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * ExperienceConfig.getInstance().getRepairXPBase() * ExperienceConfig.getInstance().getRepairXP(repairable.getRepairItemMaterialCategory())), XPGainReason.PVE); + applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) + * repairable.getXpMultiplier()) + * ExperienceConfig.getInstance().getRepairXPBase() + * ExperienceConfig.getInstance().getRepairXP(repairable.getRepairItemMaterialCategory())), XPGainReason.PVE); // BWONG BWONG BWONG if (mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilUseSounds()) {