mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Actually fix maximumQuantity reading from config
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”
This commit is contained in:
parent
3c6c2837bd
commit
3f34cc7365
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user