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;
@ -61,7 +62,7 @@ public class BlockListener implements Listener {
if (b.hasMetadata("mcmmoPlacedBlock")) { if (b.hasMetadata("mcmmoPlacedBlock")) {
b.getRelative(direction).setMetadata("mcmmoNeedsTracking", new FixedMetadataValue(plugin, true)); b.getRelative(direction).setMetadata("mcmmoNeedsTracking", new FixedMetadataValue(plugin, true));
b.removeMetadata("mcmmoPlacedBlock", plugin); b.removeMetadata("mcmmoPlacedBlock", plugin);
} }
} }
for (Block b : blocks) { for (Block b : blocks) {
@ -277,13 +278,15 @@ 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 (Config.getInstance().getMiningRequiresTool() && ItemChecks.isMiningPick(inhand)) { if(!player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
event.setInstaBreak(true); if (Config.getInstance().getMiningRequiresTool() && ItemChecks.isMiningPick(inhand)) {
Mining.SuperBreakerBlockCheck(player, block); event.setInstaBreak(true);
} Mining.SuperBreakerBlockCheck(player, block);
else if (!Config.getInstance().getMiningRequiresTool()) { }
event.setInstaBreak(true); else if (!Config.getInstance().getMiningRequiresTool()) {
Mining.SuperBreakerBlockCheck(player, block); event.setInstaBreak(true);
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)) {

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,12 +168,7 @@ 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)) { miningDrops(block);
Misc.mcDropItem(block.getLocation(), new ItemStack(block.getType()));
}
else {
miningDrops(block);
}
} }
} }
} }