Mining now completely ignore Silk Touch enchanted picks

This commit is contained in:
nossr50 2012-04-30 09:30:07 -07:00
parent 7e96ced4c4
commit 5c6d10b2db
3 changed files with 15 additions and 15 deletions

View File

@ -15,6 +15,8 @@ Version 1.3.07
+ Added permission nodes for Treasure & Magic Hunter for Fishing + Added permission nodes for Treasure & Magic Hunter for Fishing
= Fixed bug where the permission node for Impact didn't work = Fixed bug where the permission node for Impact didn't work
= Fixed some bypass nodes defaulting true for Ops = Fixed some bypass nodes defaulting true for Ops
! Changed Mining to ignore blocks when the pick is enchanted with Silk Touch
! Changed Super Breaker to be non-functional when used with a Silk Touch enchanted pick
! Changed MySQL to save player information 50ms apart from each other to reduce the load on the MySQL server ! Changed MySQL to save player information 50ms apart from each other to reduce the load on the MySQL server
- Removed some unused permission nodes - Removed some unused permission nodes

View File

@ -26,6 +26,7 @@ import org.bukkit.CropState;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
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;
@ -277,6 +278,7 @@ public class BlockListener implements Listener {
} }
} }
else if (PP.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) { else if (PP.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
if(!player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
if (Config.getInstance().getMiningRequiresTool() && ItemChecks.isMiningPick(inhand)) { if (Config.getInstance().getMiningRequiresTool() && ItemChecks.isMiningPick(inhand)) {
event.setInstaBreak(true); event.setInstaBreak(true);
Mining.SuperBreakerBlockCheck(player, block); Mining.SuperBreakerBlockCheck(player, block);
@ -286,6 +288,7 @@ public class BlockListener implements Listener {
Mining.SuperBreakerBlockCheck(player, block); Mining.SuperBreakerBlockCheck(player, block);
} }
} }
}
else if (PP.getSkillLevel(SkillType.WOODCUTTING) >= LEAF_BLOWER_LEVEL && mat.equals(Material.LEAVES)) { else if (PP.getSkillLevel(SkillType.WOODCUTTING) >= LEAF_BLOWER_LEVEL && mat.equals(Material.LEAVES)) {
if (Config.getInstance().getWoodcuttingRequiresTool() && ItemChecks.isAxe(inhand)) { if (Config.getInstance().getWoodcuttingRequiresTool() && ItemChecks.isAxe(inhand)) {
if (Skills.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) { if (Skills.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) {

View File

@ -156,7 +156,7 @@ public class Mining {
* @param block The block being broken * @param block The block being broken
*/ */
public static void miningBlockCheck(Player player, Block block) { public static void miningBlockCheck(Player player, Block block) {
if (block.hasMetadata("mcmmoPlacedBlock")) { if (block.hasMetadata("mcmmoPlacedBlock") || player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
return; return;
} }
@ -168,15 +168,10 @@ public class Mining {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
if ((skillLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= skillLevel) && Permissions.getInstance().miningDoubleDrops(player)) { if ((skillLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= skillLevel) && Permissions.getInstance().miningDoubleDrops(player)) {
if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
Misc.mcDropItem(block.getLocation(), new ItemStack(block.getType()));
}
else {
miningDrops(block); miningDrops(block);
} }
} }
} }
}
/** /**
* Check to see if a block is broken by Super Breaker. * Check to see if a block is broken by Super Breaker.