Fixed bug where it was removing diamond from every stack the player had on repairs. Fixed bug where herbalism did not give the proper benefits to stew. Fixed bug where tools would say they were fully repaired, and take your iron anyways.

This commit is contained in:
nossr50 2011-02-10 11:57:59 -08:00
parent bb87bc38d6
commit 303cae0d05
3 changed files with 42 additions and 38 deletions

View File

@ -86,35 +86,40 @@ public class mcPlayerListener extends PlayerListener {
Block block = event.getBlockClicked(); Block block = event.getBlockClicked();
Player player = event.getPlayer(); Player player = event.getPlayer();
ItemStack is = player.getItemInHand(); ItemStack is = player.getItemInHand();
//BREAD
if(is.getTypeId() == 297){ if(is.getTypeId() == 297){
if(mcUsers.getProfile(player).getHerbalismInt() >= 50){ if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){
player.setHealth(player.getHealth() + 2); player.setHealth(player.getHealth() + 2);
} else if (mcUsers.getProfile(player).getHerbalismInt() > 150 && mcUsers.getProfile(player).getHerbalismInt() < 250){ } else if (mcUsers.getProfile(player).getHerbalismInt() <= 150){
player.setHealth(player.getHealth() + 4); player.setHealth(player.getHealth() + 4);
} else if (mcUsers.getProfile(player).getHerbalismInt() > 250 && mcUsers.getProfile(player).getHerbalismInt() < 400){ } else if (mcUsers.getProfile(player).getHerbalismInt() <= 250){
player.setHealth(player.getHealth() + 5); player.setHealth(player.getHealth() + 5);
} else if (mcUsers.getProfile(player).getHerbalismInt() > 400 && mcUsers.getProfile(player).getHerbalismInt() < 750){ } else if (mcUsers.getProfile(player).getHerbalismInt() <= 400){
player.setHealth(player.getHealth() + 6); player.setHealth(player.getHealth() + 6);
} else if (mcUsers.getProfile(player).getHerbalismInt() > 750){ } else if (mcUsers.getProfile(player).getHerbalismInt() <= 750){
player.setHealth(player.getHealth() + 8); player.setHealth(player.getHealth() + 8);
} }
} }
if(is.getTypeId() == 297){ //STEW
if(mcUsers.getProfile(player).getHerbalismInt() >= 50){ if(is.getTypeId() == 282){
if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){
player.setHealth(player.getHealth() + 1); player.setHealth(player.getHealth() + 1);
} else if (mcUsers.getProfile(player).getHerbalismInt() > 150 && mcUsers.getProfile(player).getHerbalismInt() < 250){ } else if (mcUsers.getProfile(player).getHerbalismInt() <= 150){
player.setHealth(player.getHealth() + 2); player.setHealth(player.getHealth() + 2);
} else if (mcUsers.getProfile(player).getHerbalismInt() > 250 && mcUsers.getProfile(player).getHerbalismInt() < 400){ } else if (mcUsers.getProfile(player).getHerbalismInt() <= 250){
player.setHealth(player.getHealth() + 3); player.setHealth(player.getHealth() + 3);
} else if (mcUsers.getProfile(player).getHerbalismInt() > 400 && mcUsers.getProfile(player).getHerbalismInt() < 750){ } else if (mcUsers.getProfile(player).getHerbalismInt() <= 400){
player.setHealth(player.getHealth() + 4); player.setHealth(player.getHealth() + 4);
} else if (mcUsers.getProfile(player).getHerbalismInt() > 750){ } else if (mcUsers.getProfile(player).getHerbalismInt() <= 750){
player.setHealth(player.getHealth() + 6); player.setHealth(player.getHealth() + 6);
} }
} }
if(block != null && block.getTypeId() == 42){ if(block != null && block.getTypeId() == 42){
short durability = is.getDurability(); short durability = is.getDurability();
if(player.getItemInHand().getDurability() > 0){ if(player.getItemInHand().getDurability() > 0){
/*
* ARMOR
*/
if(mcm.getInstance().isArmor(is) && block.getTypeId() == 42){ if(mcm.getInstance().isArmor(is) && block.getTypeId() == 42){
if(mcm.getInstance().isDiamondArmor(is) && mcm.getInstance().hasDiamond(player)){ if(mcm.getInstance().isDiamondArmor(is) && mcm.getInstance().hasDiamond(player)){
mcm.getInstance().removeDiamond(player); mcm.getInstance().removeDiamond(player);
@ -122,17 +127,12 @@ public class mcPlayerListener extends PlayerListener {
mcUsers.getProfile(player).skillUpRepair(1); mcUsers.getProfile(player).skillUpRepair(1);
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by 1. Total ("+mcUsers.getProfile(player).getRepair()+")"); player.sendMessage(ChatColor.YELLOW+"Repair skill increased by 1. Total ("+mcUsers.getProfile(player).getRepair()+")");
} else if (mcm.getInstance().isIronArmor(is) && mcm.getInstance().hasIron(player)){ } else if (mcm.getInstance().isIronArmor(is) && mcm.getInstance().hasIron(player)){
//player.sendMessage(ChatColor.DARK_RED+"Changing the durability of iron armor is currently bugged.");
//player.sendMessage(ChatColor.YELLOW+"I'm looking into this issue. -mcMMO Author");
mcm.getInstance().removeIron(player); mcm.getInstance().removeIron(player);
player.getItemInHand().setDurability(mcm.getInstance().getArmorRepairAmount(is, player)); player.getItemInHand().setDurability(mcm.getInstance().getArmorRepairAmount(is, player));
mcUsers.getProfile(player).skillUpRepair(1); mcUsers.getProfile(player).skillUpRepair(1);
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by 1. Total ("+mcUsers.getProfile(player).getRepair()+")"); player.sendMessage(ChatColor.YELLOW+"Repair skill increased by 1. Total ("+mcUsers.getProfile(player).getRepair()+")");
} }
} }
} else {
player.sendMessage("That is at full durability.");
}
/* /*
* TOOLS * TOOLS
*/ */
@ -159,6 +159,9 @@ public class mcPlayerListener extends PlayerListener {
} else if (mcm.getInstance().isIronArmor(is) && !mcm.getInstance().hasIron(player)) } else if (mcm.getInstance().isIronArmor(is) && !mcm.getInstance().hasIron(player))
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GRAY+ "Iron"); player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GRAY+ "Iron");
} }
} else {
player.sendMessage("That is at full durability.");
}
} }
} }
public void onPlayerCommand(PlayerChatEvent event) { public void onPlayerCommand(PlayerChatEvent event) {

View File

@ -582,6 +582,7 @@ public class mcm {
x.setAmount(x.getAmount() - 1); x.setAmount(x.getAmount() - 1);
player.getInventory().setContents(inventory); player.getInventory().setContents(inventory);
} }
return;
} }
} }
} }

View File

@ -1,3 +1,3 @@
name: mcMMO name: mcMMO
main: com.bukkit.nossr50.mcMMO.mcMMO main: com.bukkit.nossr50.mcMMO.mcMMO
version: 0.4.3 version: 0.4.4