Abilities damage tools again.

Closes MCCORE-30
This commit is contained in:
nossr50 2012-02-23 00:10:22 -08:00
parent cb4b5d1c71
commit 89802e23e2
2 changed files with 25 additions and 0 deletions

View File

@ -16,6 +16,7 @@ Version 1.3.00-dev
+ Added framework for new Blast Mining skill + Added framework for new Blast Mining skill
+ Added Fast Food Service subskill to Taming + Added Fast Food Service subskill to Taming
+ Re-added mcMMO reporting damage events + 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 not giving proper XP for different kinds of trees
= Fixed Tree Feller conflicting with NoCheat = Fixed Tree Feller conflicting with NoCheat
= Fixed memory leak with mob spawner tracking = Fixed memory leak with mob spawner tracking

View File

@ -28,6 +28,7 @@ import com.gmail.nossr50.datatypes.SkillType;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -287,10 +288,22 @@ public class mcBlockListener implements Listener
if(LoadProperties.excavationRequiresShovel) if(LoadProperties.excavationRequiresShovel)
{ {
if(m.isShovel(inhand)){ if(m.isShovel(inhand)){
event.setInstaBreak(true); event.setInstaBreak(true);
Excavation.gigaDrillBreaker(player, block); Excavation.gigaDrillBreaker(player, block);
} }
} else { } 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); event.setInstaBreak(true);
Excavation.gigaDrillBreaker(player, block); Excavation.gigaDrillBreaker(player, block);
} }
@ -323,6 +336,17 @@ public class mcBlockListener implements Listener
if(LoadProperties.miningrequirespickaxe) if(LoadProperties.miningrequirespickaxe)
{ {
if(m.isMiningPick(inhand)){ 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); event.setInstaBreak(true);
Mining.SuperBreakerBlockCheck(player, block, plugin); Mining.SuperBreakerBlockCheck(player, block, plugin);
} }