From 67314e1320a9c9a648f7fbcb08003c9687597ec3 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sun, 25 May 2014 23:20:19 +0200 Subject: [PATCH] Actually fix maximumQuantity reading from config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now we try to automatically detect the maximum quantity if possible and fall back to the config if the user has set a value there. Also fixed the feedback message which said „Minimum quantity” instead of „Maximum quantity” --- .../nossr50/config/skills/salvage/SalvageConfig.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java index df073d0ec..884c1a563 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java @@ -123,14 +123,20 @@ public class SalvageConfig extends ConfigLoader { } // Maximum Quantity - int maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", -1); + int maximumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), salvageMaterial, salvageMetadata) : config.getInt("Salvageables." + key + ".MaximumQuantity", 2)); if (maximumQuantity <= 0 && itemMaterial != null) { - maximumQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), salvageMaterial, salvageMetadata); + maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", 2); + } + + int configMaximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", -1); + + if (configMaximumQuantity > 0) { + maximumQuantity = configMaximumQuantity; } if (maximumQuantity <= 0) { - reason.add("Minimum quantity of " + key + " must be greater than 0!"); + reason.add("Maximum quantity of " + key + " must be greater than 0!"); } if (noErrorsInSalvageable(reason)) {