From 89802e23e28f0e5d1c5ea798b74014164e0e0f00 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 23 Feb 2012 00:10:22 -0800 Subject: [PATCH] Abilities damage tools again. Closes MCCORE-30 --- Changelog.txt | 1 + .../nossr50/listeners/mcBlockListener.java | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index 8e2002beb..219e41ef1 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -16,6 +16,7 @@ Version 1.3.00-dev + Added framework for new Blast Mining skill + Added Fast Food Service subskill to Taming + Re-added mcMMO reporting damage events + = Fixed Super Breaker & Giga Drill Breaker failing to damage tools = Fixed Tree Feller not giving proper XP for different kinds of trees = Fixed Tree Feller conflicting with NoCheat = Fixed memory leak with mob spawner tracking diff --git a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java index a45de7f85..e096c95e4 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -28,6 +28,7 @@ import com.gmail.nossr50.datatypes.SkillType; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -287,10 +288,22 @@ public class mcBlockListener implements Listener if(LoadProperties.excavationRequiresShovel) { if(m.isShovel(inhand)){ + event.setInstaBreak(true); Excavation.gigaDrillBreaker(player, block); } } else { + + if(LoadProperties.toolsLoseDurabilityFromAbilities) + { + if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY)) + { + short durability = player.getItemInHand().getDurability(); + durability += (LoadProperties.abilityDurabilityLoss); + player.getItemInHand().setDurability(durability); + } + } + event.setInstaBreak(true); Excavation.gigaDrillBreaker(player, block); } @@ -323,6 +336,17 @@ public class mcBlockListener implements Listener if(LoadProperties.miningrequirespickaxe) { 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); + } + } + event.setInstaBreak(true); Mining.SuperBreakerBlockCheck(player, block, plugin); }