Restored original behavior of Salvage.isSalvageable

It doesn't check for custom armors, I don't know if it's a bug or not
Added isMinecraftTool and isMinecraftArmor for clarity
This commit is contained in:
bm01 2013-02-12 19:15:17 +01:00
parent f486492c37
commit 9f22382506
2 changed files with 13 additions and 3 deletions

View File

@ -141,10 +141,10 @@ public class Salvage {
* @return true if the item is salvageable, false otherwise
*/
public static boolean isSalvageable(final ItemStack is) {
if (configInstance.getSalvageTools() && (ItemChecks.isTool(is) || ItemChecks.isStringTool(is) || is.getType() == Material.BUCKET)) {
if (configInstance.getSalvageTools() && (ItemChecks.isMinecraftArmor(is) || ItemChecks.isStringTool(is) || is.getType() == Material.BUCKET)) {
return true;
}
if (configInstance.getSalvageArmor() && ItemChecks.isArmor(is)) {
if (configInstance.getSalvageArmor() && ItemChecks.isMinecraftArmor(is)) {
return true;
}
return false;

View File

@ -257,6 +257,16 @@ public class ItemChecks {
return isHelmet(is) || isChestplate(is) || isLeggings(is) || isBoots(is);
}
/**
* Checks to see if an item is a wearable armor piece.
*
* @param is Item to check
* @return true if the item is armor, false otherwise
*/
public static boolean isMinecraftArmor(ItemStack is) {
return isDiamondArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is);
}
/**
* Checks to see if an item is a leather armor piece.
*
@ -339,7 +349,7 @@ public class ItemChecks {
* @param is Item to check
* @return true if the item is a tool, false otherwise
*/
public static boolean isTool(ItemStack is) {
public static boolean isMinecraftTool(ItemStack is) {
return isStoneTool(is) || isWoodTool(is) || isGoldTool(is) || isIronTool(is) || isDiamondTool(is) || isStringTool(is);
}