Update src/main/java/com/gmail/nossr50/skills/Repair.java

This commit is contained in:
gmcferrin 2012-01-26 10:56:16 -05:00
parent 984dbd9b7a
commit 328c7d4b5f

View File

@ -47,7 +47,10 @@ public class Repair {
private static String nDiamond = LoadProperties.nDiamond; private static String nDiamond = LoadProperties.nDiamond;
private static int rIron = LoadProperties.rIron; private static int rIron = LoadProperties.rIron;
private static String nIron = LoadProperties.nIron; private static String nIron = LoadProperties.nIron;
private static int rString = LoadProperties.rString;
private static String nString = LoadProperties.nString;
private static int rLeather = LoadProperties.rLeather;
private static String nLeather = LoadProperties.nLeather;
public static void repairCheck(Player player, ItemStack is, Block block){ public static void repairCheck(Player player, ItemStack is, Block block){
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
@ -120,6 +123,21 @@ public class Repair {
SpoutStuff.playRepairNoise(player); SpoutStuff.playRepairNoise(player);
} }
//LEATHER ARMOR
else if (isLeatherArmor(is) && hasItem(player, rLeather)){
removeItem(player, rLeather);
repairItem(player, enchants, enchantsLevel);
durabilityAfter = player.getItemInHand().getDurability();
dif = (short) (durabilityBefore - durabilityAfter);
dif = (short) (dif * 1); //Boost XP
PP.addXP(SkillType.REPAIR, dif*10, player);
//CLANG CLANG
if(LoadProperties.spoutEnabled)
SpoutStuff.playRepairNoise(player);
}
//UNABLE TO REPAIR //UNABLE TO REPAIR
else { else {
needMoreVespeneGas(is, player); needMoreVespeneGas(is, player);
@ -362,7 +380,11 @@ public class Repair {
public static boolean isArmor(ItemStack is){ public static boolean isArmor(ItemStack is){
return is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 || //IRON return is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 || //IRON
is.getTypeId() == 310 ||is.getTypeId() == 311 ||is.getTypeId() == 312 ||is.getTypeId() == 313 || //DIAMOND is.getTypeId() == 310 ||is.getTypeId() == 311 ||is.getTypeId() == 312 ||is.getTypeId() == 313 || //DIAMOND
is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317; //GOLD is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317 || //GOLD
is.getTypeId() == 298 || is.getTypeId() == 299 || is.getTypeId() == 300 || is.getTypeId() == 301; //LEATHER
}
public static boolean isLeatherArmor(ItemStack is){
return is.getTypeId() == 298 || is.getTypeId() == 299 || is.getTypeId() == 300 || is.getTypeId() == 301;
} }
public static boolean isGoldArmor(ItemStack is){ public static boolean isGoldArmor(ItemStack is){
return is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317; return is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317;
@ -652,6 +674,8 @@ public class Repair {
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GRAY+ nIron); player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GRAY+ nIron);
} else if (isGoldArmor(is) && !hasItem(player, rGold)){ } else if (isGoldArmor(is) && !hasItem(player, rGold)){
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GOLD+ nGold); player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GOLD+ nGold);
} else if (isLeatherArmor(is) && !hasItem(player, rLeather)){
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.YELLOW+ nLeather);
} else if (is.getAmount() > 1) } else if (is.getAmount() > 1)
player.sendMessage(mcLocale.getString("Skills.StackedItems")); player.sendMessage(mcLocale.getString("Skills.StackedItems"));
} }