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,70 +95,41 @@ 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:
durability -= 55;
break;
case 307:
durability -= 24;
break;
case 311:
durability -= 48;
break;
case 308:
durability -= 27;
break;
case 312:
durability -= 53;
break;
case 309:
durability -= 40;
break;
case 313:
durability -= 80;
break;
} }
} if(durability < 0)
if(is.getTypeId() == 310) { durability = 0;
if(durability < 55 || checkPlayerProcRepair(player)){ if(checkPlayerProcRepair(player))
return 0; durability = 0;
} else { player.sendMessage("AFTER DURABILITY: "+durability);
return (short) (durability-55);
}
}
if(is.getTypeId() == 307){
if(durability < 24 || checkPlayerProcRepair(player)){
return 0;
} else {
return (short) (durability-24);
}
}
if(is.getTypeId() == 311){
if(durability < 48 || checkPlayerProcRepair(player)){
return 0;
} else {
return (short) (durability-48);
}
}
if(is.getTypeId() == 308){
if(durability < 27 || checkPlayerProcRepair(player)){
return 0;
} else {
return (short) (durability-27);
}
}
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; return durability;
} }
}
public short getToolRepairAmount(ItemStack is, short durability, Player player){ public short getToolRepairAmount(ItemStack is, short durability, Player player){
//IRON SHOVEL //IRON SHOVEL
if(is.getTypeId() == 256){ if(is.getTypeId() == 256){