Changed if/else to case.

This commit is contained in:
nossr50 2011-02-07 11:05:58 -08:00
parent b36e0cb27b
commit efc7b44851

View File

@ -95,69 +95,40 @@ public class mcm {
//This determines how much we repair //This determines how much we repair
public short getArmorRepairAmount(ItemStack is, Player player){ public short getArmorRepairAmount(ItemStack is, Player player){
short durability = is.getDurability(); short durability = is.getDurability();
if(is.getTypeId() == 306){ player.sendMessage("BEFORE DURABILITY: "+durability);
if(durability < 27 || checkPlayerProcRepair(player)){ switch(is.getTypeId())
return 0; {
} else { case 306:
return (short) (durability-27); durability -= 27;
} break;
} case 310:
if(is.getTypeId() == 310) { durability -= 55;
if(durability < 55 || checkPlayerProcRepair(player)){ break;
return 0; case 307:
} else { durability -= 24;
return (short) (durability-55); break;
} case 311:
} durability -= 48;
if(is.getTypeId() == 307){ break;
if(durability < 24 || checkPlayerProcRepair(player)){ case 308:
return 0; durability -= 27;
} else { break;
return (short) (durability-24); case 312:
} durability -= 53;
} break;
if(is.getTypeId() == 311){ case 309:
if(durability < 48 || checkPlayerProcRepair(player)){ durability -= 40;
return 0; break;
} else { case 313:
return (short) (durability-48); durability -= 80;
} break;
} }
if(is.getTypeId() == 308){ if(durability < 0)
if(durability < 27 || checkPlayerProcRepair(player)){ durability = 0;
return 0; if(checkPlayerProcRepair(player))
} else { durability = 0;
return (short) (durability-27); player.sendMessage("AFTER DURABILITY: "+durability);
} return durability;
}
if(is.getTypeId() == 312){
if(durability < 53 || checkPlayerProcRepair(player)){
return 0;
} else {
return (short) (durability-53);
}
}
if(is.getTypeId() == 309){
player.sendMessage("CURRENT DURABILITY: "+durability);
player.sendMessage("#1 FIRED CORRECTLY");
if(durability < 40 || checkPlayerProcRepair(player)){
player.sendMessage("#2 FIRED CORRECTLY");
return 0;
} else {
player.sendMessage("#3 FIRED CORRECTLY");
return (short) (durability - 40);
}
}
if(is.getTypeId() == 313){
if(durability < 80 || checkPlayerProcRepair(player)){
return 0;
} else {
return (short) (durability-80);
}
} else {
player.sendMessage("#4 FIRED CORRECTLY");
return durability;
}
} }
public short getToolRepairAmount(ItemStack is, short durability, Player player){ public short getToolRepairAmount(ItemStack is, short durability, Player player){
//IRON SHOVEL //IRON SHOVEL