mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Add minimum quantity back to the repair config
This commit is contained in:
parent
97c98969ff
commit
9062dbcaae
@ -1,3 +1,10 @@
|
|||||||
|
Version 2.1.77
|
||||||
|
Added minimum quantity back to Repair config
|
||||||
|
|
||||||
|
NOTES: I removed this last patch because I did not consider that server admins might be allowing users to repair items without crafting recipes (as of last patch mcMMO determines minimum quantity via counting ingredients in a recipe)
|
||||||
|
If you do not define minimum quantity in the repair config, mcMMO will grab the minimum quantity automatically as I programmed it to do as of last patch, otherwise if it is defined, mcMMO will respect that and use that for calculations.
|
||||||
|
The minimum quanitty should be set to the number of ingredients used to craft the recipe, for example 8 for diamond chestplate etc, you do not need to define this unless you are allowing players to repair custom items.
|
||||||
|
|
||||||
Version 2.1.76
|
Version 2.1.76
|
||||||
Advanced Salvage has been renamed to Scrap Collector
|
Advanced Salvage has been renamed to Scrap Collector
|
||||||
Scrap Collector has 8 ranks, the first rank is unlocked at level 2 (Level 20 in RetroMode)
|
Scrap Collector has 8 ranks, the first rank is unlocked at level 2 (Level 20 in RetroMode)
|
||||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.1.76</version>
|
<version>2.1.77-SNAPSHOT</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.skills.MaterialType;
|
|||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -132,8 +133,15 @@ public class RepairConfig extends ConfigLoader {
|
|||||||
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
|
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Minimum Quantity
|
||||||
|
int minimumQuantity = config.getInt("Repairables." + key + ".MinimumQuantity");
|
||||||
|
|
||||||
|
if(minimumQuantity == 0) {
|
||||||
|
minimumQuantity = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (noErrorsInRepairable(reason)) {
|
if (noErrorsInRepairable(reason)) {
|
||||||
Repairable repairable = RepairableFactory.getRepairable(itemMaterial, repairMaterial, minimumLevel, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
Repairable repairable = RepairableFactory.getRepairable(itemMaterial, repairMaterial, null, minimumLevel, maximumDurability, repairItemType, repairMaterialType, xpMultiplier, minimumQuantity);
|
||||||
repairables.add(repairable);
|
repairables.add(repairable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,15 @@ public class RepairableFactory {
|
|||||||
return getRepairable(itemMaterial, repairMaterial, null, minimumLevel, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
return getRepairable(itemMaterial, repairMaterial, null, minimumLevel, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, String repairMaterialPrettyName, int minimumLevel, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, String repairMaterialPrettyName,
|
||||||
|
int minimumLevel, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||||
// TODO: Add in loading from config what type of repairable we want.
|
// TODO: Add in loading from config what type of repairable we want.
|
||||||
return new SimpleRepairable(itemMaterial, repairMaterial, repairMaterialPrettyName, minimumLevel, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
return new SimpleRepairable(itemMaterial, repairMaterial, repairMaterialPrettyName, minimumLevel, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, String repairMaterialPrettyName,
|
||||||
|
int minimumLevel, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier, int minQuantity) {
|
||||||
|
// TODO: Add in loading from config what type of repairable we want.
|
||||||
|
return new SimpleRepairable(itemMaterial, repairMaterial, repairMaterialPrettyName, minimumLevel, maximumDurability, repairItemType, repairMaterialType, xpMultiplier, minQuantity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ public class SimpleRepairable implements Repairable {
|
|||||||
private final ItemType repairItemType;
|
private final ItemType repairItemType;
|
||||||
private final MaterialType repairMaterialType;
|
private final MaterialType repairMaterialType;
|
||||||
private final double xpMultiplier;
|
private final double xpMultiplier;
|
||||||
|
private int minQuantity = -1;
|
||||||
|
|
||||||
protected SimpleRepairable(Material type, Material repairMaterial, String repairMaterialPrettyName, int minimumLevel, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
protected SimpleRepairable(Material type, Material repairMaterial, String repairMaterialPrettyName, int minimumLevel, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||||
this.itemMaterial = type;
|
this.itemMaterial = type;
|
||||||
@ -27,6 +28,18 @@ public class SimpleRepairable implements Repairable {
|
|||||||
this.xpMultiplier = xpMultiplier;
|
this.xpMultiplier = xpMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected SimpleRepairable(Material type, Material repairMaterial, String repairMaterialPrettyName, int minimumLevel, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier, int minQuantity) {
|
||||||
|
this.itemMaterial = type;
|
||||||
|
this.repairMaterial = repairMaterial;
|
||||||
|
this.repairMaterialPrettyName = repairMaterialPrettyName;
|
||||||
|
this.repairItemType = repairItemType;
|
||||||
|
this.repairMaterialType = repairMaterialType;
|
||||||
|
this.minimumLevel = minimumLevel;
|
||||||
|
this.maximumDurability = maximumDurability;
|
||||||
|
this.xpMultiplier = xpMultiplier;
|
||||||
|
this.minQuantity = minQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Material getItemMaterial() {
|
public Material getItemMaterial() {
|
||||||
return itemMaterial;
|
return itemMaterial;
|
||||||
@ -54,7 +67,10 @@ public class SimpleRepairable implements Repairable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinimumQuantity() {
|
public int getMinimumQuantity() {
|
||||||
|
if(minQuantity != -1)
|
||||||
return Math.max(SkillUtils.getRepairAndSalvageQuantities(itemMaterial, repairMaterial), 2);
|
return Math.max(SkillUtils.getRepairAndSalvageQuantities(itemMaterial, repairMaterial), 2);
|
||||||
|
else
|
||||||
|
return minQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user