mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Rework armor.yml to take item names instead of IDs in advance of 1.7 changes.
** YOU WILL NEED TO REDO YOUR armor.yml FILE **
This commit is contained in:
parent
933b6f278b
commit
792ecd6aad
@ -1,15 +1,15 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomItem;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.Repairable;
|
||||
import com.gmail.nossr50.skills.repair.RepairableFactory;
|
||||
|
||||
@ -18,14 +18,11 @@ public class CustomArmorConfig extends ConfigLoader {
|
||||
|
||||
private List<Repairable> repairables;
|
||||
|
||||
public List<Integer> customBootIDs = new ArrayList<Integer>();
|
||||
public List<Integer> customChestplateIDs = new ArrayList<Integer>();
|
||||
public List<Integer> customHelmetIDs = new ArrayList<Integer>();
|
||||
public List<Integer> customLeggingIDs = new ArrayList<Integer>();
|
||||
public List<Integer> customIDs = new ArrayList<Integer>();
|
||||
|
||||
public List<CustomItem> customArmorList = new ArrayList<CustomItem>();
|
||||
public HashMap<Integer, CustomItem> customArmor = new HashMap<Integer, CustomItem>();
|
||||
public List<Material> customBoots = new ArrayList<Material>();
|
||||
public List<Material> customChestplates = new ArrayList<Material>();
|
||||
public List<Material> customHelmets = new ArrayList<Material>();
|
||||
public List<Material> customLeggings = new ArrayList<Material>();
|
||||
public List<Material> customArmor = new ArrayList<Material>();
|
||||
|
||||
public CustomArmorConfig() {
|
||||
super("ModConfigs", "armor.yml");
|
||||
@ -52,13 +49,13 @@ public class CustomArmorConfig extends ConfigLoader {
|
||||
protected void loadKeys() {
|
||||
repairables = new ArrayList<Repairable>();
|
||||
|
||||
loadArmor("Boots", customBootIDs);
|
||||
loadArmor("Chestplates", customChestplateIDs);
|
||||
loadArmor("Helmets", customHelmetIDs);
|
||||
loadArmor("Leggings", customLeggingIDs);
|
||||
loadArmor("Boots", customBoots);
|
||||
loadArmor("Chestplates", customChestplates);
|
||||
loadArmor("Helmets", customHelmets);
|
||||
loadArmor("Leggings", customLeggings);
|
||||
}
|
||||
|
||||
private void loadArmor(String armorType, List<Integer> idList) {
|
||||
private void loadArmor(String armorType, List<Material> materialList) {
|
||||
ConfigurationSection armorSection = config.getConfigurationSection(armorType);
|
||||
|
||||
if (armorSection == null) {
|
||||
@ -68,35 +65,40 @@ public class CustomArmorConfig extends ConfigLoader {
|
||||
Set<String> armorConfigSet = armorSection.getKeys(false);
|
||||
|
||||
for (String armorName : armorConfigSet) {
|
||||
int id = config.getInt(armorType + "." + armorName + ".ID", 0);
|
||||
boolean repairable = config.getBoolean(armorType + "." + armorName + ".Repairable");
|
||||
int repairID = config.getInt(armorType + "." + armorName + ".Repair_Material_ID", 0);
|
||||
byte repairData = (byte) config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Value", 0);
|
||||
int repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Quantity", 0);
|
||||
short durability = (short) config.getInt(armorType + "." + armorName + ".Durability", 0);
|
||||
Material armorMaterial = Material.matchMaterial(armorName);
|
||||
|
||||
if (id == 0) {
|
||||
plugin.getLogger().warning("Missing ID. This item will be skipped.");
|
||||
if (armorMaterial == null) {
|
||||
plugin.getLogger().warning("Invalid material name. This item will be skipped.");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (repairable && (repairID == 0 || repairQuantity == 0 || durability == 0)) {
|
||||
boolean repairable = config.getBoolean(armorType + "." + armorName + ".Repairable");
|
||||
Material repairMaterial = Material.matchMaterial(config.getString(armorType + "." + armorName + ".Repair_Material", ""));
|
||||
|
||||
if (repairMaterial == null) {
|
||||
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable.");
|
||||
repairable = false;
|
||||
}
|
||||
|
||||
CustomItem armor;
|
||||
|
||||
if (repairable) {
|
||||
repairables.add(RepairableFactory.getRepairable(Material.getMaterial(id), Material.getMaterial(repairID), repairData, repairQuantity, durability));
|
||||
byte repairData = (byte) config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Value", -1);
|
||||
int repairQuantity = Repair.getRepairAndSalvageQuantities(new ItemStack(armorMaterial), repairMaterial, repairData);
|
||||
|
||||
if (repairQuantity == 0) {
|
||||
repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Quantity", 2);
|
||||
}
|
||||
|
||||
short durability = armorMaterial.getMaxDurability();
|
||||
|
||||
if (durability == 0) {
|
||||
durability = (short) config.getInt(armorType + "." + armorName + ".Durability", 70);
|
||||
}
|
||||
|
||||
repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, repairQuantity, durability));
|
||||
}
|
||||
|
||||
armor = new CustomItem(id, durability);
|
||||
|
||||
idList.add(id);
|
||||
customIDs.add(id);
|
||||
customArmorList.add(armor);
|
||||
customArmor.put(id, armor);
|
||||
materialList.add(armorMaterial);
|
||||
customArmor.add(armorMaterial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class CustomToolConfig extends ConfigLoader {
|
||||
repairables.add(RepairableFactory.getRepairable(Material.getMaterial(id), Material.getMaterial(repairID), repairData, repairQuantity, durability));
|
||||
}
|
||||
|
||||
tool = new CustomTool(tier, abilityEnabled, multiplier, durability, id);
|
||||
tool = new CustomTool(tier, abilityEnabled, multiplier, id);
|
||||
|
||||
idList.add(id);
|
||||
customIDs.add(id);
|
||||
|
@ -1,27 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes.mods;
|
||||
|
||||
public class CustomItem {
|
||||
protected int itemID;
|
||||
protected short durability;
|
||||
|
||||
public CustomItem(int itemID, short durability) {
|
||||
this.itemID = itemID;
|
||||
this.durability = durability;
|
||||
}
|
||||
|
||||
public int getItemID() {
|
||||
return itemID;
|
||||
}
|
||||
|
||||
public void setItemID(int itemID) {
|
||||
this.itemID = itemID;
|
||||
}
|
||||
|
||||
public short getDurability() {
|
||||
return durability;
|
||||
}
|
||||
|
||||
public void setDurability(short durability) {
|
||||
this.durability = durability;
|
||||
}
|
||||
}
|
@ -1,17 +1,28 @@
|
||||
package com.gmail.nossr50.datatypes.mods;
|
||||
|
||||
public class CustomTool extends CustomItem {
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class CustomTool {
|
||||
private Material material;
|
||||
private double xpMultiplier;
|
||||
private boolean abilityEnabled;
|
||||
private int tier;
|
||||
|
||||
public CustomTool(int tier, boolean abilityEnabled, double xpMultiplier, short durability, int itemID) {
|
||||
super(itemID, durability);
|
||||
public CustomTool(int tier, boolean abilityEnabled, double xpMultiplier, int itemID) {
|
||||
this.material = Material.getMaterial(itemID);
|
||||
this.xpMultiplier = xpMultiplier;
|
||||
this.abilityEnabled = abilityEnabled;
|
||||
this.tier = tier;
|
||||
}
|
||||
|
||||
public Material getType() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public void setType(Material material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public double getXpMultiplier() {
|
||||
return xpMultiplier;
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
@ -99,7 +98,7 @@ public class AxesManager extends SkillManager {
|
||||
if (ItemUtils.isArmor(armor) && Axes.impactChance > Misc.getRandom().nextInt(getActivationChance())) {
|
||||
double durabilityModifier = 1 / (armor.getEnchantmentLevel(Enchantment.DURABILITY) + 1); // Modifier to simulate the durability enchantment behavior
|
||||
double modifiedDurabilityDamage = durabilityDamage * durabilityModifier;
|
||||
short maxDurability = ModUtils.isCustomArmor(armor) ? ModUtils.getArmorFromItemStack(armor).getDurability() : armor.getType().getMaxDurability();
|
||||
short maxDurability = armor.getType().getMaxDurability();
|
||||
double maxDurabilityDamage = maxDurability * Axes.impactMaxDurabilityModifier;
|
||||
|
||||
armor.setDurability((short) (Math.min(modifiedDurabilityDamage, maxDurabilityDamage) + armor.getDurability()));
|
||||
|
@ -5,6 +5,7 @@ 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.AdvancedConfig;
|
||||
@ -112,25 +113,29 @@ public class Repair {
|
||||
}
|
||||
}
|
||||
|
||||
Recipe recipe = mcMMO.p.getServer().getRecipesFor(inHand).get(0);
|
||||
int salvageAmount = 0;
|
||||
Material salvageMaterial = getSalvagedItem(inHand);
|
||||
return getRepairAndSalvageQuantities(inHand, getSalvagedItem(inHand), (byte) -1);
|
||||
}
|
||||
|
||||
public static int getRepairAndSalvageQuantities(ItemStack item, Material repairMaterial, byte repairMetadata) {
|
||||
int quantity = 0;
|
||||
MaterialData repairData = new MaterialData(repairMaterial, 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() == salvageMaterial) {
|
||||
salvageAmount += ingredient.getAmount();
|
||||
if (ingredient != null && ingredient.getType() == repairMaterial && (repairMetadata == -1 || ingredient.getData() == repairData)) {
|
||||
quantity += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (recipe instanceof ShapedRecipe) {
|
||||
for (ItemStack ingredient : ((ShapedRecipe) recipe).getIngredientMap().values()) {
|
||||
if (ingredient != null && ingredient.getType() == salvageMaterial) {
|
||||
salvageAmount += ingredient.getAmount();
|
||||
if (ingredient != null && ingredient.getType() == repairMaterial && (repairMetadata == -1 || ingredient.getData() == repairData)) {
|
||||
quantity += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return salvageAmount;
|
||||
return quantity;
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,9 @@ 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.Repair;
|
||||
import com.gmail.nossr50.skills.repair.RepairItemType;
|
||||
import com.gmail.nossr50.skills.repair.RepairMaterialType;
|
||||
import com.gmail.nossr50.skills.repair.Repairable;
|
||||
@ -100,7 +96,7 @@ public class RepairConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
// Maximum Durability
|
||||
short maximumDurability = (config.contains("Repairables." + key + ".MaximumDurability") ? (short) config.getInt("Repairables." + key + ".MaximumDurability") : (itemMaterial != null ? itemMaterial.getMaxDurability() : 0));
|
||||
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Repairables." + key + ".MaximumDurability"));
|
||||
|
||||
if (maximumDurability <= 0) {
|
||||
reason.add("Maximum durability of " + key + " must be greater than 0!");
|
||||
@ -129,7 +125,7 @@ public class RepairConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
int repairMetadata = config.getInt("Repairables." + key + ".RepairMaterialMetadata", -1);
|
||||
byte repairMetadata = (byte) config.getInt("Repairables." + key + ".RepairMaterialMetadata", -1);
|
||||
int minimumLevel = config.getInt("Repairables." + key + ".MinimumLevel");
|
||||
double xpMultiplier = config.getDouble("Repairables." + key + ".XpMultiplier", 1);
|
||||
|
||||
@ -138,38 +134,14 @@ public class RepairConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int minimumQuantity = (itemMaterial != null ? Repair.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), repairMaterial, repairMetadata) : config.getInt("Repairables." + key + ".MinimumQuantity"));
|
||||
|
||||
if (minimumQuantity <= 0) {
|
||||
reason.add("Minimum quantity of " + key + " must be greater than 0!");
|
||||
}
|
||||
|
||||
if (noErrorsInRepairable(reason)) {
|
||||
Repairable repairable = RepairableFactory.getRepairable(itemMaterial, repairMaterial, (byte) repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||
Repairable repairable = RepairableFactory.getRepairable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||
repairables.add(repairable);
|
||||
}
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ public final class Woodcutting {
|
||||
}
|
||||
|
||||
short finalDurability = (short) (inHand.getDurability() + durabilityLoss);
|
||||
short maxDurability = ModUtils.isCustomTool(inHand) ? ModUtils.getToolFromItemStack(inHand).getDurability() : inHandMaterial.getMaxDurability();
|
||||
short maxDurability = inHandMaterial.getMaxDurability();
|
||||
boolean overMax = (finalDurability >= maxDurability);
|
||||
|
||||
inHand.setDurability(overMax ? maxDurability : finalDurability);
|
||||
|
@ -121,7 +121,9 @@ public class ItemUtils {
|
||||
* @return true if the item is a helmet, false otherwise
|
||||
*/
|
||||
public static boolean isHelmet(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
case DIAMOND_HELMET:
|
||||
case GOLD_HELMET:
|
||||
case IRON_HELMET:
|
||||
@ -130,7 +132,7 @@ public class ItemUtils {
|
||||
return true;
|
||||
|
||||
default:
|
||||
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().customHelmetIDs.contains(item.getTypeId());
|
||||
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().customHelmets.contains(type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,7 +143,9 @@ public class ItemUtils {
|
||||
* @return true if the item is a chestplate, false otherwise
|
||||
*/
|
||||
public static boolean isChestplate(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
case DIAMOND_CHESTPLATE:
|
||||
case GOLD_CHESTPLATE:
|
||||
case IRON_CHESTPLATE:
|
||||
@ -150,7 +154,7 @@ public class ItemUtils {
|
||||
return true;
|
||||
|
||||
default:
|
||||
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().customChestplateIDs.contains(item.getTypeId());
|
||||
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().customChestplates.contains(type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,7 +165,9 @@ public class ItemUtils {
|
||||
* @return true if the item is a pair of pants, false otherwise
|
||||
*/
|
||||
public static boolean isLeggings(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
case DIAMOND_LEGGINGS:
|
||||
case GOLD_LEGGINGS:
|
||||
case IRON_LEGGINGS:
|
||||
@ -170,7 +176,7 @@ public class ItemUtils {
|
||||
return true;
|
||||
|
||||
default:
|
||||
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().customLeggingIDs.contains(item.getTypeId());
|
||||
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().customLeggings.contains(type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,7 +187,9 @@ public class ItemUtils {
|
||||
* @return true if the item is a pair of boots, false otherwise
|
||||
*/
|
||||
public static boolean isBoots(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
case DIAMOND_BOOTS:
|
||||
case GOLD_BOOTS:
|
||||
case IRON_BOOTS:
|
||||
@ -190,7 +198,7 @@ public class ItemUtils {
|
||||
return true;
|
||||
|
||||
default:
|
||||
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().customBootIDs.contains(item.getTypeId());
|
||||
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().customBoots.contains(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.util;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
||||
@ -11,7 +12,6 @@ import com.gmail.nossr50.config.mods.CustomEntityConfig;
|
||||
import com.gmail.nossr50.config.mods.CustomToolConfig;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomItem;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||
|
||||
public final class ModUtils {
|
||||
@ -24,16 +24,6 @@ public final class ModUtils {
|
||||
|
||||
private ModUtils() {}
|
||||
|
||||
/**
|
||||
* Get the custom armor associated with an item.
|
||||
*
|
||||
* @param item The item to check
|
||||
* @return the armor if it exists, null otherwise
|
||||
*/
|
||||
public static CustomItem getArmorFromItemStack(ItemStack item) {
|
||||
return CustomArmorConfig.getInstance().customArmor.get(item.getTypeId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom tool associated with an item.
|
||||
*
|
||||
@ -56,7 +46,7 @@ public final class ModUtils {
|
||||
|
||||
if (CustomBlockConfig.getInstance().customItems.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
if ((block.getItemID() == blockState.getTypeId()) && (block.getDataValue() == blockState.getRawData())) {
|
||||
if (new MaterialData(block.getItemID(), block.getDataValue()).equals(blockState.getData())) {
|
||||
return block;
|
||||
}
|
||||
}
|
||||
@ -92,7 +82,7 @@ public final class ModUtils {
|
||||
|
||||
if (CustomBlockConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
if ((block.getItemID() == blockState.getTypeId()) && (block.getDataValue() == blockState.getRawData())) {
|
||||
if (new MaterialData(block.getItemID(), block.getDataValue()).equals(blockState.getData())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -114,7 +104,7 @@ public final class ModUtils {
|
||||
|
||||
if (CustomBlockConfig.getInstance().customAbilityBlocks.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
if ((block.getItemID() == blockState.getTypeId()) && (block.getDataValue() == blockState.getRawData())) {
|
||||
if (new MaterialData(block.getItemID(), block.getDataValue()).equals(blockState.getData())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -136,7 +126,7 @@ public final class ModUtils {
|
||||
|
||||
if (CustomBlockConfig.getInstance().customMiningBlocks.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
if ((block.getItemID() == blockState.getTypeId()) && (block.getDataValue() == blockState.getRawData())) {
|
||||
if (new MaterialData(block.getItemID(), block.getDataValue()).equals(blockState.getData())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -158,7 +148,7 @@ public final class ModUtils {
|
||||
|
||||
if (CustomBlockConfig.getInstance().customExcavationBlocks.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
if ((block.getItemID() == blockState.getTypeId()) && (block.getDataValue() == blockState.getRawData())) {
|
||||
if (new MaterialData(block.getItemID(), block.getDataValue()).equals(blockState.getData())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -180,7 +170,7 @@ public final class ModUtils {
|
||||
|
||||
if (CustomBlockConfig.getInstance().customHerbalismBlocks.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
if ((block.getItemID() == blockState.getTypeId()) && (block.getDataValue() == blockState.getRawData())) {
|
||||
if (new MaterialData(block.getItemID(), block.getDataValue()).equals(blockState.getData())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -202,7 +192,7 @@ public final class ModUtils {
|
||||
|
||||
if (CustomBlockConfig.getInstance().customLeaves.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
if ((block.getItemID() == blockState.getTypeId()) && (block.getDataValue() == blockState.getRawData())) {
|
||||
if (new MaterialData(block.getItemID(), block.getDataValue()).equals(blockState.getData())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -224,7 +214,7 @@ public final class ModUtils {
|
||||
|
||||
if (CustomBlockConfig.getInstance().customLogs.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
if ((block.getItemID() == blockState.getTypeId()) && (block.getDataValue() == blockState.getRawData())) {
|
||||
if (new MaterialData(block.getItemID(), block.getDataValue()).equals(blockState.getData())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -246,7 +236,7 @@ public final class ModUtils {
|
||||
|
||||
if (CustomBlockConfig.getInstance().customOres.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
if ((block.getItemID() == blockState.getTypeId()) && (block.getDataValue() == blockState.getRawData())) {
|
||||
if (new MaterialData(block.getItemID(), block.getDataValue()).equals(blockState.getData())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -277,7 +267,7 @@ public final class ModUtils {
|
||||
* @return true if the item is custom armor, false otherwise
|
||||
*/
|
||||
public static boolean isCustomArmor(ItemStack item) {
|
||||
if (customArmorEnabled && CustomArmorConfig.getInstance().customArmor.containsKey(item.getTypeId())) {
|
||||
if (customArmorEnabled && CustomArmorConfig.getInstance().customArmor.contains(item.getType())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -460,7 +460,7 @@ public class SkillUtils {
|
||||
*/
|
||||
public static ItemStack handleDurabilityChange(ItemStack itemStack, int durabilityModifier) {
|
||||
short finalDurability = (short) (itemStack.getDurability() + durabilityModifier);
|
||||
short maxDurability = ModUtils.isCustomTool(itemStack) ? ModUtils.getToolFromItemStack(itemStack).getDurability() : itemStack.getType().getMaxDurability();
|
||||
short maxDurability = itemStack.getType().getMaxDurability();
|
||||
boolean overMax = (finalDurability >= maxDurability);
|
||||
|
||||
itemStack.setDurability(overMax ? maxDurability : finalDurability);
|
||||
|
@ -3,73 +3,62 @@
|
||||
###
|
||||
Boots:
|
||||
Boot_1:
|
||||
ID: 999
|
||||
Repairable: true
|
||||
Repair_Material_ID: 99
|
||||
Repair_Material: REPAIR_MATERIAL_NAME
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 9
|
||||
Durability: 9999
|
||||
Durability: 999
|
||||
Boot_2:
|
||||
ID: 999
|
||||
Repairable: true
|
||||
Repair_Material_ID: 99
|
||||
Repair_Material: REPAIR_MATERIAL_NAME
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 9
|
||||
Durability: 9999
|
||||
|
||||
Durability: 999
|
||||
#
|
||||
# Settings for Chestplates
|
||||
###
|
||||
Chestplates:
|
||||
Chestplate_1:
|
||||
ID: 999
|
||||
Repairable: true
|
||||
Repair_Material_ID: 99
|
||||
Repair_Material: REPAIR_MATERIAL_NAME
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 9
|
||||
Durability: 9999
|
||||
Durability: 999
|
||||
Chestplate_2:
|
||||
ID: 999
|
||||
Repairable: true
|
||||
Repair_Material_ID: 99
|
||||
Repair_Material: REPAIR_MATERIAL_NAME
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 9
|
||||
Durability: 9999
|
||||
|
||||
Durability: 999
|
||||
#
|
||||
# Settings for Helmets
|
||||
###
|
||||
Helmets:
|
||||
Helmet_1:
|
||||
ID: 999
|
||||
Repairable: true
|
||||
Repair_Material_ID: 99
|
||||
Repair_Material: REPAIR_MATERIAL_NAME
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 9
|
||||
Durability: 9999
|
||||
Durability: 999
|
||||
Helmet_2:
|
||||
ID: 999
|
||||
Repairable: true
|
||||
Repair_Material_ID: 99
|
||||
Repair_Material: REPAIR_MATERIAL_NAME
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 9
|
||||
Durability: 9999
|
||||
|
||||
Durability: 999
|
||||
#
|
||||
# Settings for Leggings
|
||||
###
|
||||
Leggings:
|
||||
Legging_1:
|
||||
ID: 999
|
||||
Repairable: true
|
||||
Repair_Material_ID: 99
|
||||
Repair_Material: REPAIR_MATERIAL_NAME
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 9
|
||||
Durability: 9999
|
||||
Durability: 999
|
||||
Legging_2:
|
||||
ID: 999
|
||||
Repairable: true
|
||||
Repair_Material_ID: 99
|
||||
Repair_Material: REPAIR_MATERIAL_NAME
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 9
|
||||
Durability: 9999
|
||||
Durability: 999
|
Loading…
Reference in New Issue
Block a user