From badc5738ff1ecf95fa820da03add1be1c9a9a155 Mon Sep 17 00:00:00 2001 From: NuclearW Date: Tue, 22 May 2012 05:27:21 -0400 Subject: [PATCH] Fix up repair command as best as possible given what it is... --- .../nossr50/commands/skills/RepairCommand.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index ff4cfc09c..d0d9e576e 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -7,12 +7,14 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.repair.Repair; +import com.gmail.nossr50.skills.repair.Repairable; import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Users; @@ -128,12 +130,17 @@ public class RepairCommand implements CommandExecutor { private void dataCalculations(float skillValue) { DecimalFormat percent = new DecimalFormat("##0.00%"); - Config configInstance = Config.getInstance(); - diamondLevel = configInstance.getRepairDiamondLevelRequirement(); - goldLevel = configInstance.getRepairGoldLevelRequirement(); - ironLevel = configInstance.getRepairIronLevelRequirement(); - stoneLevel = configInstance.getRepairStoneLevelRequirement(); + // We're using pickaxes here, not the best but works + Repairable diamondRepairable = mcMMO.repairManager.getRepairable(278); + Repairable goldRepairable = mcMMO.repairManager.getRepairable(285); + Repairable ironRepairable = mcMMO.repairManager.getRepairable(257); + Repairable stoneRepairable = mcMMO.repairManager.getRepairable(274); + + diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel(); + goldLevel = (goldRepairable == null) ? 0 : goldRepairable.getMinimumLevel(); + ironLevel = (ironRepairable == null) ? 0 : ironRepairable.getMinimumLevel(); + stoneLevel = (stoneRepairable == null) ? 0 : stoneRepairable.getMinimumLevel(); repairMasteryBonus = percent.format(skillValue / 500);