Can only seem to make the axe splinter some of the time..

This commit is contained in:
nossr50 2012-03-02 11:22:29 -08:00
parent 1ac544511c
commit 05cea84dcc
2 changed files with 21 additions and 3 deletions

View File

@ -448,6 +448,23 @@ public class Repair {
}
return false;
}
public static short getMaxDurability(ItemStack is)
{
if(isDiamondTools(is))
return (short) 1562;
else if(isIronTools(is))
return (short) 251;
else if(isGoldTools(is))
return (short) 33;
else if(isStoneTools(is))
return (short) 132;
else if(isWoodTools(is))
return (short) 66;
else
return 0;
}
public static boolean isBow(ItemStack is){
return is.getType() == Material.BOW;
}

View File

@ -17,6 +17,8 @@
package com.gmail.nossr50.skills;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
@ -37,7 +39,6 @@ import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.config.*;
import org.getspout.commons.ChatColor;
import org.getspout.spoutapi.sound.SoundEffect;
@ -70,10 +71,10 @@ public class WoodCutting
//Damage the tool
player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability()+durabilityLoss));
player.updateInventory(); //Silly deprecated methods
//This is to prevent using wood axes everytime you tree fell
if(player.getItemInHand().getType() == Material.AIR || player.getItemInHand() == null)
if(player.getItemInHand().getDurability() >= Repair.getMaxDurability(player.getItemInHand())
|| player.getItemInHand().getType() == Material.AIR || player.getItemInHand() == null)
{
player.sendMessage(ChatColor.RED+"YOUR AXE SPLINTERS INTO DOZENS OF PIECES");