diff --git a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java index c1ef58f3f..a8afbc7fc 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -162,7 +162,7 @@ public class mcBlockListener implements Listener //Green Terra if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && block.getTypeId() == 59 && block.getData() == (byte) 0x07) { - Herbalism.greenTerraCheck(player, block); + Herbalism.greenTerraCheck(player); } //Wheat && Triple drops @@ -224,7 +224,7 @@ public class mcBlockListener implements Listener */ if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalism(player) && Herbalism.canBeGreenTerra(block)) { - Herbalism.greenTerraCheck(player, block); + Herbalism.greenTerraCheck(player); } if(mcPermissions.getInstance().herbalism(player) && block.getData() != (byte) 5) @@ -252,19 +252,22 @@ public class mcBlockListener implements Listener /* * ABILITY PREPARATION CHECKS */ - if(PP.getHoePreparationMode() && Herbalism.canBeGreenTerra(block)) - Herbalism.greenTerraCheck(player, block); - if(PP.getAxePreparationMode() && block.getTypeId() == 17) - WoodCutting.treeFellerCheck(player, block); - if(PP.getPickaxePreparationMode() && Mining.canBeSuperBroken(block)) - Mining.superBreakerCheck(player, block); - if(PP.getShovelPreparationMode() && Excavation.canBeGigaDrillBroken(block)) - Excavation.gigaDrillBreakerActivationCheck(player, block); + if(m.abilityBlockCheck(block)) + { + if(PP.getHoePreparationMode() && Herbalism.canBeGreenTerra(block)) + Herbalism.greenTerraCheck(player); + if(PP.getAxePreparationMode() && block.getTypeId() == 17) + WoodCutting.treeFellerCheck(player); + if(PP.getPickaxePreparationMode() && Mining.canBeSuperBroken(block)) + Mining.superBreakerCheck(player); + if(PP.getShovelPreparationMode() && Excavation.canBeGigaDrillBroken(block)) + Excavation.gigaDrillBreakerActivationCheck(player); + } if(PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78)) Unarmed.berserkActivationCheck(player); /* - * TREE FELLAN STUFF + * TREE FELLER STUFF */ if(LoadProperties.spoutEnabled && block.getTypeId() == 17 && Users.getProfile(player).getTreeFellerMode()) SpoutStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation()); @@ -273,9 +276,7 @@ public class mcBlockListener implements Listener * GREEN TERRA STUFF */ if(PP.getGreenTerraMode() && mcPermissions.getInstance().herbalismAbility(player) && PP.getGreenTerraMode()) - { Herbalism.greenTerra(player, block); - } /* * GIGA DRILL BREAKER CHECKS @@ -296,11 +297,11 @@ public class mcBlockListener implements Listener if(LoadProperties.toolsLoseDurabilityFromAbilities) { - if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY)) + if(!inhand.containsEnchantment(Enchantment.DURABILITY)) { - short durability = player.getItemInHand().getDurability(); + short durability = inhand.getDurability(); durability += (LoadProperties.abilityDurabilityLoss); - player.getItemInHand().setDurability(durability); + inhand.setDurability(durability); } } @@ -337,15 +338,15 @@ public class mcBlockListener implements Listener { if(m.isMiningPick(inhand)){ - if(LoadProperties.toolsLoseDurabilityFromAbilities) - { - if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY)) - { - short durability = player.getItemInHand().getDurability(); - durability += (LoadProperties.abilityDurabilityLoss); - player.getItemInHand().setDurability(durability); - } - } + if(LoadProperties.toolsLoseDurabilityFromAbilities) + { + if(!inhand.containsEnchantment(Enchantment.DURABILITY)) + { + short durability = inhand.getDurability(); + durability += (LoadProperties.abilityDurabilityLoss); + inhand.setDurability(durability); + } + } event.setInstaBreak(true); Mining.SuperBreakerBlockCheck(player, block, plugin); diff --git a/src/main/java/com/gmail/nossr50/skills/Excavation.java b/src/main/java/com/gmail/nossr50/skills/Excavation.java index 786e5d1f2..71b7f16e9 100644 --- a/src/main/java/com/gmail/nossr50/skills/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/Excavation.java @@ -41,20 +41,14 @@ import org.getspout.spoutapi.sound.SoundEffect; public class Excavation { - public static void gigaDrillBreakerActivationCheck(Player player, Block block) + public static void gigaDrillBreakerActivationCheck(Player player) { PlayerProfile PP = Users.getProfile(player); if(m.isShovel(player.getItemInHand())) { - if(block != null) - { - if(!m.abilityBlockCheck(block)) - return; - } if(PP.getShovelPreparationMode()) - { PP.setShovelPreparationMode(false); - } + int ticks = 2; int x = PP.getSkillLevel(SkillType.EXCAVATION); while(x >= 50) diff --git a/src/main/java/com/gmail/nossr50/skills/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/Herbalism.java index 0c9ef1958..cad33017b 100644 --- a/src/main/java/com/gmail/nossr50/skills/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/Herbalism.java @@ -37,20 +37,13 @@ import com.gmail.nossr50.locale.mcLocale; public class Herbalism { - public static void greenTerraCheck(Player player, Block block) + public static void greenTerraCheck(Player player) { PlayerProfile PP = Users.getProfile(player); if(m.isHoe(player.getItemInHand())) { - if(block != null) - { - if(!m.abilityBlockCheck(block)) - return; - } if(PP.getHoePreparationMode()) - { PP.setHoePreparationMode(false); - } int ticks = 2; int x = PP.getSkillLevel(SkillType.HERBALISM); while(x >= 50) diff --git a/src/main/java/com/gmail/nossr50/skills/Mining.java b/src/main/java/com/gmail/nossr50/skills/Mining.java index 1baa36843..c00ce3cf4 100644 --- a/src/main/java/com/gmail/nossr50/skills/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/Mining.java @@ -39,20 +39,13 @@ import com.gmail.nossr50.locale.mcLocale; public class Mining { - public static void superBreakerCheck(Player player, Block block) + public static void superBreakerCheck(Player player) { PlayerProfile PP = Users.getProfile(player); if(m.isMiningPick(player.getItemInHand())) { - if(block != null) - { - if(!m.abilityBlockCheck(block)) - return; - } if(PP.getPickaxePreparationMode()) - { PP.setPickaxePreparationMode(false); - } int ticks = 2; int x = PP.getSkillLevel(SkillType.MINING); diff --git a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java index 4f9c501f9..3c994c183 100644 --- a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java @@ -194,23 +194,16 @@ public class WoodCutting } } - public static void treeFellerCheck(Player player, Block block) + public static void treeFellerCheck(Player player) { PlayerProfile PP = Users.getProfile(player); if(m.isAxes(player.getItemInHand())) { - if(block != null) - { - if(!m.abilityBlockCheck(block)) - return; - } /* * CHECK FOR AXE PREP MODE */ if(PP.getAxePreparationMode()) - { PP.setAxePreparationMode(false); - } int ticks = 2; int x = PP.getSkillLevel(SkillType.WOODCUTTING);