Reworked abilityDurabilityLoss() to take an int as dmg dealt

This commit is contained in:
nossr50 2012-03-04 12:21:24 -08:00
parent 07296f14d7
commit 5da59e6f0a
4 changed files with 11 additions and 9 deletions

View File

@ -173,7 +173,7 @@ public class Excavation
public static void gigaDrillBreaker(Player player, Block block)
{
Skills.abilityDurabilityLoss(player.getItemInHand());
Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss);
if(block.getData() != (byte)5)
{
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);

View File

@ -177,10 +177,15 @@ public class Mining
public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin)
{
PlayerProfile PP = Users.getProfile(player);
Skills.abilityDurabilityLoss(player.getItemInHand());
Material type = block.getType();
//Obsidian needs to do more damage than normal
if(type != Material.OBSIDIAN)
Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss);
else
Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss*5);
//Pre-processing
Material type = block.getType();
int xp = 0;
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);

View File

@ -271,15 +271,13 @@ public class Skills
return false;
}
public static void abilityDurabilityLoss(ItemStack inhand)
public static void abilityDurabilityLoss(ItemStack inhand, int durabilityLoss)
{
if(LoadProperties.toolsLoseDurabilityFromAbilities)
{
if(!inhand.containsEnchantment(Enchantment.DURABILITY))
{
short durability = inhand.getDurability();
durability += (LoadProperties.abilityDurabilityLoss);
inhand.setDurability(durability);
inhand.setDurability((short)(inhand.getDurability()+durabilityLoss));
}
}
}

View File

@ -160,7 +160,6 @@ public class WoodCutting
PP.addXP(SkillType.WOODCUTTING, xp, player); //Tree Feller gives nerf'd XP
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
Skills.abilityDurabilityLoss(player.getItemInHand());
}
private static boolean treeFellerCompatible(Block block)
@ -265,7 +264,7 @@ public class WoodCutting
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
Bukkit.getPluginManager().callEvent(armswing);
Skills.abilityDurabilityLoss(player.getItemInHand());
Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss);
if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}