mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Changed format of repair.vanilla.yml. **YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT**
This commit is contained in:
parent
59a35b170c
commit
5d7d779a49
@ -36,6 +36,7 @@ Version 1.4.07-dev
|
||||
= Fixed a bug where the "Dodge" DamageModifier wasn't being read from advanced.yml
|
||||
= Fixed a bug where squid were not awarding XP.
|
||||
! Changed format of treasures.yml. **YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT**
|
||||
! Changed format of repair.vanilla.yml. **YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT**
|
||||
! Witches no longer drop water bottles from Shake, since they no longer drop them in Vanilla.
|
||||
! Changed various values to double in advanced.yml for the sake of consistency.
|
||||
! Nerfed Archery damage to eliminate constant one-hit kills.
|
||||
|
@ -41,10 +41,10 @@ public class RepairCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
// We're using pickaxes here, not the best but it works
|
||||
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE.getId());
|
||||
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLD_PICKAXE.getId());
|
||||
Repairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE.getId());
|
||||
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE.getId());
|
||||
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE);
|
||||
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLD_PICKAXE);
|
||||
Repairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE);
|
||||
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE);
|
||||
|
||||
// TODO: This isn't really accurate - if they don't have pickaxes loaded it doesn't always mean the repair level is 0
|
||||
diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
|
||||
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
@ -87,7 +88,7 @@ public class CustomArmorConfig extends ConfigLoader {
|
||||
CustomItem armor;
|
||||
|
||||
if (repairable) {
|
||||
repairables.add(RepairableFactory.getRepairable(id, repairID, repairData, repairQuantity, durability));
|
||||
repairables.add(RepairableFactory.getRepairable(Material.getMaterial(id), Material.getMaterial(repairID), repairData, repairQuantity, durability));
|
||||
}
|
||||
|
||||
armor = new CustomItem(id, durability);
|
||||
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
@ -93,7 +94,7 @@ public class CustomToolConfig extends ConfigLoader {
|
||||
CustomTool tool;
|
||||
|
||||
if (repairable) {
|
||||
repairables.add(RepairableFactory.getRepairable(id, repairID, repairData, repairQuantity, durability));
|
||||
repairables.add(RepairableFactory.getRepairable(Material.getMaterial(id), Material.getMaterial(repairID), repairData, repairQuantity, durability));
|
||||
}
|
||||
|
||||
tool = new CustomTool(tier, abilityEnabled, multiplier, durability, id);
|
||||
|
@ -52,9 +52,7 @@ public class RepairManager extends SkillManager {
|
||||
|
||||
public void handleRepair(ItemStack item) {
|
||||
Player player = getPlayer();
|
||||
int itemId = item.getTypeId();
|
||||
|
||||
Repairable repairable = mcMMO.getRepairableManager().getRepairable(itemId);
|
||||
Repairable repairable = mcMMO.getRepairableManager().getRepairable(item.getType());
|
||||
|
||||
// Permissions checks on material and item types
|
||||
if (!repairable.getRepairItemType().getPermissions(player)) {
|
||||
@ -78,13 +76,13 @@ public class RepairManager extends SkillManager {
|
||||
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
|
||||
int repairMaterialId = repairable.getRepairMaterialId();
|
||||
Material repairMaterial = repairable.getRepairMaterial();
|
||||
byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
|
||||
ItemStack toRemove = new MaterialData(repairMaterialId, repairMaterialMetadata).toItemStack(1);
|
||||
ItemStack toRemove = new MaterialData(repairMaterial, repairMaterialMetadata).toItemStack(1);
|
||||
|
||||
// Check if they have the proper material to repair with
|
||||
if (!inventory.contains(Material.getMaterial(repairMaterialId))) {
|
||||
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterialId));
|
||||
if (!inventory.contains(repairMaterial)) {
|
||||
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial));
|
||||
|
||||
if (repairMaterialMetadata != (byte) -1 && !inventory.containsAtLeast(toRemove, 1)) {
|
||||
message += ":" + repairMaterialMetadata;
|
||||
@ -131,7 +129,7 @@ public class RepairManager extends SkillManager {
|
||||
|
||||
// Remove the item
|
||||
if (repairMaterialMetadata == -1) {
|
||||
toRemove = inventory.getItem(inventory.first(Material.getMaterial(repairMaterialId))).clone();
|
||||
toRemove = inventory.getItem(inventory.first(repairMaterial)).clone();
|
||||
toRemove.setAmount(1);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@ -50,4 +51,33 @@ public enum RepairMaterialType {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Material getDefaultRepairMaterial() {
|
||||
switch (this) {
|
||||
case STRING:
|
||||
return Material.STRING;
|
||||
|
||||
case LEATHER:
|
||||
return Material.LEATHER;
|
||||
|
||||
case WOOD:
|
||||
return Material.WOOD;
|
||||
|
||||
case STONE:
|
||||
return Material.COBBLESTONE;
|
||||
|
||||
case IRON:
|
||||
return Material.IRON_INGOT;
|
||||
|
||||
case GOLD:
|
||||
return Material.GOLD_INGOT;
|
||||
|
||||
case DIAMOND:
|
||||
return Material.DIAMOND;
|
||||
|
||||
case OTHER:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,21 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public interface Repairable {
|
||||
/**
|
||||
* Gets the item id of this repairable item
|
||||
* Gets the type of this repairable item
|
||||
*
|
||||
* @return the id of this repairable
|
||||
* @return the type of this repairable
|
||||
*/
|
||||
public int getItemId();
|
||||
public Material getItemMaterial();
|
||||
|
||||
/**
|
||||
* Gets the id of the material used to repair this item
|
||||
*
|
||||
* @return the id of the repair material
|
||||
*/
|
||||
public int getRepairMaterialId();
|
||||
public Material getRepairMaterial();
|
||||
|
||||
/**
|
||||
* Gets the metadata byte value of the material used to repair this item
|
||||
|
@ -1,12 +1,14 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class RepairableFactory {
|
||||
public static Repairable getRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumQuantity, short maximumDurability) {
|
||||
return getRepairable(itemId, repairMaterialId, repairMetadata, 0, minimumQuantity, maximumDurability, RepairItemType.OTHER, RepairMaterialType.OTHER, 1);
|
||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumQuantity, short maximumDurability) {
|
||||
return getRepairable(itemMaterial, repairMaterial, repairMetadata, 0, minimumQuantity, maximumDurability, RepairItemType.OTHER, RepairMaterialType.OTHER, 1);
|
||||
}
|
||||
|
||||
public static Repairable getRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType, double xpMultiplier) {
|
||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType, double xpMultiplier) {
|
||||
// TODO: Add in loading from config what type of repairable we want.
|
||||
return new SimpleRepairable(itemId, repairMaterialId, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||
return new SimpleRepairable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface RepairableManager {
|
||||
@ -22,10 +23,10 @@ public interface RepairableManager {
|
||||
/**
|
||||
* Checks if an item is repairable
|
||||
*
|
||||
* @param itemId id to check if repairable
|
||||
* @param type Material to check if repairable
|
||||
* @return true if repairable, false if not
|
||||
*/
|
||||
public boolean isRepairable(int itemId);
|
||||
public boolean isRepairable(Material type);
|
||||
|
||||
/**
|
||||
* Checks if an item is repairable
|
||||
@ -36,10 +37,10 @@ public interface RepairableManager {
|
||||
public boolean isRepairable(ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Gets the repairable with this id
|
||||
* Gets the repairable with this type
|
||||
*
|
||||
* @param id Id of the repairable to look for
|
||||
* @param type Material of the repairable to look for
|
||||
* @return the repairable, can be null
|
||||
*/
|
||||
public Repairable getRepairable(int id);
|
||||
public Repairable getRepairable(Material type);
|
||||
}
|
||||
|
@ -1,16 +1,19 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class SimpleRepairable implements Repairable {
|
||||
private final int itemId, repairMaterialId, minimumQuantity, minimumLevel;
|
||||
private final Material itemMaterial, repairMaterial;
|
||||
private final int minimumQuantity, minimumLevel;
|
||||
private final short maximumDurability, baseRepairDurability;
|
||||
private final byte repairMetadata;
|
||||
private final RepairItemType repairItemType;
|
||||
private final RepairMaterialType repairMaterialType;
|
||||
private final double xpMultiplier;
|
||||
|
||||
protected SimpleRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType, double xpMultiplier) {
|
||||
this.itemId = itemId;
|
||||
this.repairMaterialId = repairMaterialId;
|
||||
protected SimpleRepairable(Material type, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType, double xpMultiplier) {
|
||||
this.itemMaterial = type;
|
||||
this.repairMaterial = repairMaterial;
|
||||
this.repairMetadata = repairMetadata;
|
||||
this.repairItemType = repairItemType;
|
||||
this.repairMaterialType = repairMaterialType;
|
||||
@ -22,13 +25,13 @@ public class SimpleRepairable implements Repairable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemId() {
|
||||
return itemId;
|
||||
public Material getItemMaterial() {
|
||||
return itemMaterial;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRepairMaterialId() {
|
||||
return repairMaterialId;
|
||||
public Material getRepairMaterial() {
|
||||
return repairMaterial;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,23 +3,24 @@ package com.gmail.nossr50.skills.repair;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SimpleRepairableManager implements RepairableManager {
|
||||
private HashMap<Integer, Repairable> repairables;
|
||||
private HashMap<Material, Repairable> repairables;
|
||||
|
||||
protected SimpleRepairableManager() {
|
||||
this(55);
|
||||
}
|
||||
|
||||
protected SimpleRepairableManager(int repairablesSize) {
|
||||
this.repairables = new HashMap<Integer, Repairable>(repairablesSize);
|
||||
this.repairables = new HashMap<Material, Repairable>(repairablesSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRepairable(Repairable repairable) {
|
||||
Integer itemId = repairable.getItemId();
|
||||
repairables.put(itemId, repairable);
|
||||
Material item = repairable.getItemMaterial();
|
||||
repairables.put(item, repairable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -30,17 +31,17 @@ public class SimpleRepairableManager implements RepairableManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable(int itemId) {
|
||||
return repairables.containsKey(itemId);
|
||||
public boolean isRepairable(Material type) {
|
||||
return repairables.containsKey(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable(ItemStack itemStack) {
|
||||
return isRepairable(itemStack.getTypeId());
|
||||
return isRepairable(itemStack.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Repairable getRepairable(int id) {
|
||||
return repairables.get(id);
|
||||
public Repairable getRepairable(Material type) {
|
||||
return repairables.get(type);
|
||||
}
|
||||
}
|
||||
|
@ -4,13 +4,21 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.ShapelessRecipe;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.skills.repair.RepairItemType;
|
||||
import com.gmail.nossr50.skills.repair.RepairMaterialType;
|
||||
import com.gmail.nossr50.skills.repair.Repairable;
|
||||
import com.gmail.nossr50.skills.repair.RepairableFactory;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
|
||||
public class RepairConfig extends ConfigLoader {
|
||||
private List<Repairable> repairables;
|
||||
@ -28,60 +36,142 @@ public class RepairConfig extends ConfigLoader {
|
||||
Set<String> keys = section.getKeys(false);
|
||||
|
||||
for (String key : keys) {
|
||||
if (config.contains("Repairables." + key + ".ItemId")) {
|
||||
plugin.getLogger().warning("You are using an old version of the repair.yml file.");
|
||||
plugin.getLogger().warning("You should delete your current file and allow a new one to generate.");
|
||||
plugin.getLogger().warning("Repair will not work properly until you do.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate all the things!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
|
||||
if (!config.contains("Repairables." + key + ".ItemId")) {
|
||||
reason.add(key + " is missing ItemId");
|
||||
// Item Material
|
||||
Material itemMaterial = Material.matchMaterial(key);
|
||||
|
||||
if (itemMaterial == null) {
|
||||
reason.add("Invalid material: " + key);
|
||||
}
|
||||
|
||||
if (!config.contains("Repairables." + key + ".RepairMaterialId")) {
|
||||
reason.add(key + " is missing RepairMaterialId");
|
||||
// Repair Material Type
|
||||
RepairMaterialType repairMaterialType = RepairMaterialType.OTHER;
|
||||
String repairMaterialTypeString = config.getString("Repairables." + key + ".MaterialType", "OTHER");
|
||||
|
||||
if (!config.contains("Repairables." + key + ".MaterialType") && itemMaterial != null) {
|
||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
||||
|
||||
if (ItemUtils.isWoodTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.STONE;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.STRING;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.IRON;
|
||||
}
|
||||
else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.GOLD;
|
||||
}
|
||||
else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.DIAMOND;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
repairMaterialType = RepairMaterialType.valueOf(repairMaterialTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid MaterialType of " + repairMaterialTypeString);
|
||||
}
|
||||
}
|
||||
|
||||
if (!config.contains("Repairables." + key + ".MaximumDurability")) {
|
||||
reason.add(key + " is missing MaximumDurability");
|
||||
// Repair Material
|
||||
String repairMaterialName = config.getString("Repairables." + key + ".RepairMaterial");
|
||||
Material repairMaterial = (repairMaterialName == null ? repairMaterialType.getDefaultRepairMaterial() : Material.matchMaterial(repairMaterialName));
|
||||
|
||||
if (repairMaterial == null) {
|
||||
reason.add(key + " has an invalid repair material: " + repairMaterialName);
|
||||
}
|
||||
|
||||
int itemId = config.getInt("Repairables." + key + ".ItemId", 0);
|
||||
int repairMaterialId = config.getInt("Repairables." + key + ".RepairMaterialId", 0);
|
||||
int maximumDurability = config.getInt("Repairables." + key + ".MaximumDurability", 0);
|
||||
// Maximum Durability
|
||||
short maximumDurability = (config.contains("Repairables." + key + ".MaximumDurability") ? (short) config.getInt("Repairables." + key + ".MaximumDurability") : (itemMaterial != null ? itemMaterial.getMaxDurability() : 0));
|
||||
|
||||
if (maximumDurability <= 0) {
|
||||
reason.add("Maxium durability of " + key + " must be greater than 0!");
|
||||
}
|
||||
|
||||
// Item Type
|
||||
RepairItemType repairItemType = RepairItemType.OTHER;
|
||||
String repairItemTypeString = config.getString("Repairables." + key + ".ItemType", "OTHER");
|
||||
|
||||
if (!config.contains("Repairables." + key + ".ItemType") && itemMaterial != null) {
|
||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
||||
|
||||
if (ItemUtils.isMinecraftTool(repairItem)) {
|
||||
repairItemType = RepairItemType.TOOL;
|
||||
}
|
||||
else if (ItemUtils.isArmor(repairItem)) {
|
||||
repairItemType = RepairItemType.ARMOR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
repairItemType = RepairItemType.valueOf(repairItemTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid ItemType of " + repairItemTypeString);
|
||||
}
|
||||
}
|
||||
|
||||
int repairMetadata = config.getInt("Repairables." + key + ".RepairMaterialMetadata", -1);
|
||||
int minimumLevel = config.getInt("Repairables." + key + ".MinimumLevel", 0);
|
||||
int minimumQuantity = config.getInt("Repairables." + key + ".MinimumQuantity", 2);
|
||||
int minimumLevel = config.getInt("Repairables." + key + ".MinimumLevel");
|
||||
double xpMultiplier = config.getDouble("Repairables." + key + ".XpMultiplier", 1);
|
||||
|
||||
RepairItemType repairItemType = RepairItemType.OTHER;
|
||||
RepairMaterialType repairMaterialType = RepairMaterialType.OTHER;
|
||||
|
||||
String repairItemTypeString = config.getString("Repairables." + key + ".ItemType", "OTHER");
|
||||
String repairMaterialTypeString = config.getString("Repairables." + key + ".MaterialType", "OTHER");
|
||||
|
||||
if (minimumLevel < 0) {
|
||||
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
|
||||
}
|
||||
|
||||
if (minimumQuantity < 0) {
|
||||
reason.add(key + " has an invalid MinimumQuantity of " + minimumQuantity);
|
||||
// Minimum Quantity
|
||||
int minimumQuantity = 0;
|
||||
|
||||
if (config.contains("Repairables." + key + ".MinimumQuantity")) {
|
||||
minimumQuantity = config.getInt("Repairables." + key + ".MinimumQuantity");
|
||||
}
|
||||
else if (itemMaterial != null) {
|
||||
ItemStack item = new ItemStack(itemMaterial);
|
||||
MaterialData repairData = new MaterialData(repairMaterial, (byte) repairMetadata);
|
||||
Recipe recipe = mcMMO.p.getServer().getRecipesFor(item).get(0);
|
||||
|
||||
if (recipe instanceof ShapelessRecipe) {
|
||||
for (ItemStack ingredient : ((ShapelessRecipe) recipe).getIngredientList()) {
|
||||
if (ingredient != null && ingredient.getType() == repairMaterial && (repairMetadata == -1 || ingredient.getData() == repairData)) {
|
||||
minimumQuantity += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (recipe instanceof ShapedRecipe) {
|
||||
for (ItemStack ingredient : ((ShapedRecipe) recipe).getIngredientMap().values()) {
|
||||
if (ingredient != null && ingredient.getType() == repairMaterial && (repairMetadata == -1 || ingredient.getData() == repairData)) {
|
||||
minimumQuantity += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
repairItemType = RepairItemType.valueOf(repairItemTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid ItemType of " + repairItemTypeString);
|
||||
}
|
||||
System.out.println("Minimum quantity of " + key + ": " + minimumQuantity);
|
||||
|
||||
try {
|
||||
repairMaterialType = RepairMaterialType.valueOf(repairMaterialTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid MaterialType of " + repairMaterialTypeString);
|
||||
if (minimumQuantity <= 0) {
|
||||
reason.add("Minimum quantity of " + key + " must be greater than 0!");
|
||||
}
|
||||
|
||||
if (noErrorsInRepairable(reason)) {
|
||||
Repairable repairable = RepairableFactory.getRepairable(itemId, repairMaterialId, (byte) repairMetadata, minimumLevel, minimumQuantity, (short) maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||
Repairable repairable = RepairableFactory.getRepairable(itemMaterial, repairMaterial, (byte) repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||
repairables.add(repairable);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,9 @@
|
||||
## Last updated on ${project.version}-b${BUILD_NUMBER}
|
||||
#
|
||||
# Any file named repair.*.yml in the mcmmmo folder will be loaded as a repair config
|
||||
# All repair configs have a main section titled "Repairables"
|
||||
# Afterwards, all sub-items are considered a Repairable to be loaded
|
||||
# The bare minimum of a Repairable is that it have an ItemId, a RepairMaterialId, and a MaximumDurability
|
||||
#
|
||||
# ItemId: This is the id of the item to be repairable.
|
||||
## This is required to be set.
|
||||
# Afterwards, all sub-items are considered a Repairable to be loaded. The names of each subitem should be the exact material name.
|
||||
# The bare minimum of a Repairable is that it have a RepairMaterial and a MaximumDurability
|
||||
#
|
||||
# ItemType: This is the type of item to be repaired, this is only important to permissions.
|
||||
## Valid values are ARMOR, TOOL, and OTHER.
|
||||
@ -15,7 +13,7 @@
|
||||
## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER
|
||||
## This defaults to OTHER.
|
||||
#
|
||||
# RepairMaterialId: This is the id of the item used to repair this repairable.
|
||||
# RepairMaterial: This is the material name of the item used to repair this repairable.
|
||||
## This is required to be set.
|
||||
#
|
||||
# RepairMaterialMetadata: This is the metadata of the item used to repair this repairable.
|
||||
@ -26,7 +24,7 @@
|
||||
## This is required to be set.
|
||||
#
|
||||
# MinimumLevel: This is the minimum repair level needed to repair this item.
|
||||
## Valid values are > 0
|
||||
## Valid values are => 0
|
||||
## This defaults to 0
|
||||
#
|
||||
# MinimumQuantity: This is the minimum number of items needed to repair this item ignoring all other repair bonuses.
|
||||
@ -46,470 +44,162 @@ Repairables:
|
||||
# Wooden repairables
|
||||
###
|
||||
# Tools
|
||||
WoodSword:
|
||||
ItemId: 268
|
||||
ItemType: TOOL
|
||||
MaterialType: WOOD
|
||||
RepairMaterialId: 5
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 59
|
||||
WOOD_SWORD:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: .25
|
||||
WoodShovel:
|
||||
ItemId: 269
|
||||
ItemType: TOOL
|
||||
MaterialType: WOOD
|
||||
RepairMaterialId: 5
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 59
|
||||
WOOD_SPADE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 1
|
||||
XpMultiplier: .16
|
||||
WoodPickaxe:
|
||||
ItemId: 270
|
||||
ItemType: TOOL
|
||||
MaterialType: WOOD
|
||||
RepairMaterialId: 5
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 59
|
||||
WOOD_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 3
|
||||
XpMultiplier: .5
|
||||
WoodAxe:
|
||||
ItemId: 271
|
||||
ItemType: TOOL
|
||||
MaterialType: WOOD
|
||||
RepairMaterialId: 5
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 59
|
||||
WOOD_AXE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 3
|
||||
XpMultiplier: .5
|
||||
WoodHoe:
|
||||
ItemId: 290
|
||||
ItemType: TOOL
|
||||
MaterialType: WOOD
|
||||
RepairMaterialId: 5
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 59
|
||||
WOOD_HOE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: .25
|
||||
#
|
||||
# Stone repairables
|
||||
###
|
||||
# Tools
|
||||
StoneSword:
|
||||
ItemId: 272
|
||||
ItemType: TOOL
|
||||
MaterialType: STONE
|
||||
RepairMaterialId: 4
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 131
|
||||
STONE_SWORD:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: .25
|
||||
StoneShovel:
|
||||
ItemId: 273
|
||||
ItemType: TOOL
|
||||
MaterialType: STONE
|
||||
RepairMaterialId: 4
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 131
|
||||
STONE_SPADE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 1
|
||||
XpMultiplier: .16
|
||||
StonePickaxe:
|
||||
ItemId: 274
|
||||
ItemType: TOOL
|
||||
MaterialType: STONE
|
||||
RepairMaterialId: 4
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 131
|
||||
STONE_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 3
|
||||
XpMultiplier: .5
|
||||
StoneAxe:
|
||||
ItemId: 275
|
||||
ItemType: TOOL
|
||||
MaterialType: STONE
|
||||
RepairMaterialId: 4
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 131
|
||||
STONE_AXE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 3
|
||||
XpMultiplier: .5
|
||||
StoneHoe:
|
||||
ItemId: 291
|
||||
ItemType: TOOL
|
||||
MaterialType: STONE
|
||||
RepairMaterialId: 4
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 131
|
||||
STONE_HOE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: .25
|
||||
#
|
||||
# Iron repairables
|
||||
###
|
||||
# Tools
|
||||
IronSword:
|
||||
ItemId: 267
|
||||
ItemType: TOOL
|
||||
MaterialType: IRON
|
||||
RepairMaterialId: 265
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 250
|
||||
IRON_SWORD:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: .5
|
||||
IronShovel:
|
||||
ItemId: 256
|
||||
ItemType: TOOL
|
||||
MaterialType: IRON
|
||||
RepairMaterialId: 265
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 250
|
||||
IRON_SPADE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 1
|
||||
XpMultiplier: .3
|
||||
IronPickaxe:
|
||||
ItemId: 257
|
||||
ItemType: TOOL
|
||||
MaterialType: IRON
|
||||
RepairMaterialId: 265
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 250
|
||||
IRON_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 3
|
||||
XpMultiplier: 1
|
||||
IronAxe:
|
||||
ItemId: 258
|
||||
ItemType: TOOL
|
||||
MaterialType: IRON
|
||||
RepairMaterialId: 265
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 250
|
||||
IRON_AXE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 3
|
||||
XpMultiplier: 1
|
||||
IronHoe:
|
||||
ItemId: 292
|
||||
ItemType: TOOL
|
||||
MaterialType: IRON
|
||||
RepairMaterialId: 265
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 250
|
||||
IRON_HOE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: .5
|
||||
Shears:
|
||||
ItemId: 359
|
||||
ItemType: TOOL
|
||||
MaterialType: IRON
|
||||
RepairMaterialId: 265
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 238
|
||||
SHEARS:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: 1
|
||||
# Armor
|
||||
IronHelmet:
|
||||
ItemId: 306
|
||||
ItemType: ARMOR
|
||||
MaterialType: IRON
|
||||
RepairMaterialId: 265
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 165
|
||||
IRON_HELMET:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 5
|
||||
XpMultiplier: 2
|
||||
IronChest:
|
||||
ItemId: 307
|
||||
ItemType: ARMOR
|
||||
MaterialType: IRON
|
||||
RepairMaterialId: 265
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 240
|
||||
IRON_CHESTPLATE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 8
|
||||
XpMultiplier: 2
|
||||
IronLegs:
|
||||
ItemId: 308
|
||||
ItemType: ARMOR
|
||||
MaterialType: IRON
|
||||
RepairMaterialId: 265
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 225
|
||||
IRON_LEGGINGS:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 7
|
||||
XpMultiplier: 2
|
||||
IronBoots:
|
||||
ItemId: 309
|
||||
ItemType: ARMOR
|
||||
MaterialType: IRON
|
||||
RepairMaterialId: 265
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 195
|
||||
IRON_BOOTS:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 4
|
||||
XpMultiplier: 2
|
||||
#
|
||||
# Gold repairables
|
||||
###
|
||||
# Tools
|
||||
GoldSword:
|
||||
ItemId: 283
|
||||
ItemType: TOOL
|
||||
MaterialType: GOLD
|
||||
RepairMaterialId: 266
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 32
|
||||
GOLD_SWORD:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: 4
|
||||
GoldShovel:
|
||||
ItemId: 284
|
||||
ItemType: TOOL
|
||||
MaterialType: GOLD
|
||||
RepairMaterialId: 266
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 32
|
||||
GOLD_SPADE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 1
|
||||
XpMultiplier: 2.6
|
||||
GoldPickaxe:
|
||||
ItemId: 285
|
||||
ItemType: TOOL
|
||||
MaterialType: GOLD
|
||||
RepairMaterialId: 266
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 32
|
||||
GOLD_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 3
|
||||
XpMultiplier: 8
|
||||
GoldAxe:
|
||||
ItemId: 286
|
||||
ItemType: TOOL
|
||||
MaterialType: GOLD
|
||||
RepairMaterialId: 266
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 32
|
||||
GOLD_AXE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 3
|
||||
XpMultiplier: 8
|
||||
GoldHoe:
|
||||
ItemId: 294
|
||||
ItemType: TOOL
|
||||
MaterialType: GOLD
|
||||
RepairMaterialId: 266
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 32
|
||||
GOLD_HOE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: 4
|
||||
# Armor
|
||||
GoldHelmet:
|
||||
ItemId: 314
|
||||
ItemType: ARMOR
|
||||
MaterialType: GOLD
|
||||
RepairMaterialId: 266
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 77
|
||||
GOLD_HELMET:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 5
|
||||
XpMultiplier: 4
|
||||
GoldChest:
|
||||
ItemId: 315
|
||||
ItemType: ARMOR
|
||||
MaterialType: GOLD
|
||||
RepairMaterialId: 266
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 112
|
||||
GOLD_CHESTPLATE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 8
|
||||
XpMultiplier: 4
|
||||
GoldLegs:
|
||||
ItemId: 316
|
||||
ItemType: ARMOR
|
||||
MaterialType: GOLD
|
||||
RepairMaterialId: 266
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 105
|
||||
GOLD_LEGGINGS:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 7
|
||||
XpMultiplier: 4
|
||||
GoldBoots:
|
||||
ItemId: 317
|
||||
ItemType: ARMOR
|
||||
MaterialType: GOLD
|
||||
RepairMaterialId: 266
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 91
|
||||
GOLD_BOOTS:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 4
|
||||
XpMultiplier: 4
|
||||
#
|
||||
# Diamond repairables
|
||||
###
|
||||
# Tools
|
||||
DiamondSword:
|
||||
ItemId: 276
|
||||
ItemType: TOOL
|
||||
MaterialType: DIAMOND
|
||||
RepairMaterialId: 264
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 1561
|
||||
DIAMOND_SWORD:
|
||||
MinimumLevel: 50
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: .5
|
||||
DiamondShovel:
|
||||
ItemId: 277
|
||||
ItemType: TOOL
|
||||
MaterialType: DIAMOND
|
||||
RepairMaterialId: 264
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 1561
|
||||
DIAMOND_SPADE:
|
||||
MinimumLevel: 50
|
||||
MinimumQuantity: 1
|
||||
XpMultiplier: .3
|
||||
DiamondPickaxe:
|
||||
ItemId: 278
|
||||
ItemType: TOOL
|
||||
MaterialType: DIAMOND
|
||||
RepairMaterialId: 264
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 1561
|
||||
DIAMOND_PICKAXE:
|
||||
MinimumLevel: 50
|
||||
MinimumQuantity: 3
|
||||
XpMultiplier: 1
|
||||
DiamondAxe:
|
||||
ItemId: 279
|
||||
ItemType: TOOL
|
||||
MaterialType: DIAMOND
|
||||
RepairMaterialId: 264
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 1561
|
||||
DIAMOND_AXE:
|
||||
MinimumLevel: 50
|
||||
MinimumQuantity: 3
|
||||
XpMultiplier: 1
|
||||
DiamondHoe:
|
||||
ItemId: 293
|
||||
ItemType: TOOL
|
||||
MaterialType: DIAMOND
|
||||
RepairMaterialId: 264
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 1561
|
||||
DIAMOND_HOE:
|
||||
MinimumLevel: 50
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: .5
|
||||
# Armor
|
||||
DiamondHelmet:
|
||||
ItemId: 310
|
||||
ItemType: ARMOR
|
||||
MaterialType: DIAMOND
|
||||
RepairMaterialId: 264
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 363
|
||||
DIAMOND_HELMET:
|
||||
MinimumLevel: 50
|
||||
MinimumQuantity: 5
|
||||
XpMultiplier: 6
|
||||
DiamondChest:
|
||||
ItemId: 311
|
||||
ItemType: ARMOR
|
||||
MaterialType: DIAMOND
|
||||
RepairMaterialId: 264
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 528
|
||||
DIAMOND_CHESTPLATE:
|
||||
MinimumLevel: 50
|
||||
MinimumQuantity: 8
|
||||
XpMultiplier: 6
|
||||
DiamondLegs:
|
||||
ItemId: 312
|
||||
ItemType: ARMOR
|
||||
MaterialType: DIAMOND
|
||||
RepairMaterialId: 264
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 495
|
||||
DIAMOND_LEGGINGS:
|
||||
MinimumLevel: 50
|
||||
MinimumQuantity: 7
|
||||
XpMultiplier: 6
|
||||
DiamondBoots:
|
||||
ItemId: 313
|
||||
ItemType: ARMOR
|
||||
MaterialType: DIAMOND
|
||||
RepairMaterialId: 264
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 429
|
||||
DIAMOND_BOOTS:
|
||||
MinimumLevel: 50
|
||||
MinimumQuantity: 4
|
||||
XpMultiplier: 6
|
||||
#
|
||||
# Leather repairables
|
||||
###
|
||||
# Armor
|
||||
LeatherHelmet:
|
||||
ItemId: 298
|
||||
ItemType: ARMOR
|
||||
MaterialType: LEATHER
|
||||
RepairMaterialId: 334
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 55
|
||||
LEATHER_HELMET:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 5
|
||||
XpMultiplier: 1
|
||||
LeatherChest:
|
||||
ItemId: 299
|
||||
ItemType: ARMOR
|
||||
MaterialType: LEATHER
|
||||
RepairMaterialId: 334
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 80
|
||||
LEATHER_CHESTPLATE:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 8
|
||||
XpMultiplier: 1
|
||||
LeatherLegs:
|
||||
ItemId: 300
|
||||
ItemType: ARMOR
|
||||
MaterialType: LEATHER
|
||||
RepairMaterialId: 334
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 75
|
||||
LEATHER_LEGGINGS:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 7
|
||||
XpMultiplier: 1
|
||||
LeatherBoots:
|
||||
ItemId: 301
|
||||
ItemType: ARMOR
|
||||
MaterialType: LEATHER
|
||||
RepairMaterialId: 334
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 65
|
||||
LEATHER_BOOTS:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 4
|
||||
XpMultiplier: 1
|
||||
#
|
||||
# String repairables
|
||||
###
|
||||
# Tools
|
||||
FishingRod:
|
||||
ItemId: 346
|
||||
ItemType: TOOL
|
||||
MaterialType: STRING
|
||||
RepairMaterialId: 287
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 64
|
||||
FISHING_ROD:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 2
|
||||
XpMultiplier: .5
|
||||
Bow:
|
||||
ItemId: 261
|
||||
ItemType: TOOL
|
||||
MaterialType: STRING
|
||||
RepairMaterialId: 287
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 384
|
||||
BOW:
|
||||
MinimumLevel: 0
|
||||
MinimumQuantity: 3
|
||||
XpMultiplier: .5
|
Loading…
Reference in New Issue
Block a user