From 94387045e42f0ad1263cca2d0372af99aa27132d Mon Sep 17 00:00:00 2001 From: bm01 Date: Thu, 23 Feb 2012 10:34:34 +0100 Subject: [PATCH] Removed redundant if statement --- .../com/gmail/nossr50/skills/WoodCutting.java | 91 ++++++++++--------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java index c737c2f95..f000bea12 100644 --- a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java @@ -70,56 +70,57 @@ public class WoodCutting if(m.blockBreakSimulate(x, player)) { - if(x.getType() == Material.LOG || x.getType() == Material.LEAVES) + if(x.getType() == Material.LOG) { - durabilityLoss++; //Damage the tool more if the Tree is larger - - if(x.getType() == Material.LOG) - { - byte type = x.getData(); - ItemStack item = new ItemStack(x.getType(), 1, (byte)0, type); + byte type = x.getData(); + ItemStack item = new ItemStack(x.getType(), 1, (byte)0, type); - if(!plugin.misc.blockWatchList.contains(x)) + if(!plugin.misc.blockWatchList.contains(x)) + { + WoodCutting.woodCuttingProcCheck(player, x); + int xp = 0; + + switch(x.getData()) { - WoodCutting.woodCuttingProcCheck(player, x); - int xp = 0; - - switch(x.getData()) - { - case 0: - xp += LoadProperties.mpine; - break; - case 1: - xp += LoadProperties.mspruce; - break; - case 2: - xp += LoadProperties.mbirch; - break; - } - - PP.addXP(SkillType.WOODCUTTING, xp, player); + case 0: + xp += LoadProperties.mpine; + break; + case 1: + xp += LoadProperties.mspruce; + break; + case 2: + xp += LoadProperties.mbirch; + break; } - - //Drop the block - x.getWorld().dropItemNaturally(x.getLocation(), item); - - //Remove the block - x.setData((byte) 0); - x.setType(Material.AIR); - - } else if(x.getType() == Material.LEAVES) - { - Material mat = Material.SAPLING; - ItemStack item = new ItemStack(mat, 1, (short)0, (byte)(x.getData()-8)); - - //1 in 10 chance to drop sapling - if(Math.random() * 10 > 9) - m.mcDropItem(x.getLocation(), item); - - //Remove the block - x.setData((byte) 0); - x.setType(Material.AIR); + + PP.addXP(SkillType.WOODCUTTING, xp, player); } + + //Drop the block + x.getWorld().dropItemNaturally(x.getLocation(), item); + + //Remove the block + x.setData((byte) 0); + x.setType(Material.AIR); + + //Damage the tool more if the Tree is larger + durabilityLoss++; + + } else if(x.getType() == Material.LEAVES) + { + Material mat = Material.SAPLING; + ItemStack item = new ItemStack(mat, 1, (short)0, (byte)(x.getData()-8)); + + //1 in 10 chance to drop sapling + if(Math.random() * 10 > 9) + m.mcDropItem(x.getLocation(), item); + + //Remove the block + x.setData((byte) 0); + x.setType(Material.AIR); + + //Damage the tool more if the Tree is larger + durabilityLoss++; } } }