Fixed instant break false-positive

This commit is contained in:
Adam committed 2012-05-29 17:38:38 -04:00
1 parent 5b0d53c01e
commit 0a6ac986b0
2 files changed
+4 -4

No files matched your search

@@ -76,7 +76,7 @@ public class BlockListener extends EventListener
{ {
if(checkManager.willCheck(player, CheckType.NO_SWING)) if(checkManager.willCheck(player, CheckType.NO_SWING))
{ {
if(backend.checkSwing(player)) if(backend.checkSwing(player,block))
{ {
event.setCancelled(true); event.setCancelled(true);
log("tried to break a block of "+block.getType().name()+" without swinging their arm.",player,CheckType.NO_SWING); log("tried to break a block of "+block.getType().name()+" without swinging their arm.",player,CheckType.NO_SWING);
@@ -106,7 +106,7 @@ public class BlockListener extends EventListener
@Override @Override
public void run() public void run()
{ {
backend.checkSwing(player); backend.checkSwing(player,block);
} }
}, 2L); }, 2L);
} }
@@ -384,9 +384,9 @@ public class Backend
return false; return false;
} }
public boolean checkSwing(Player player) public boolean checkSwing(Player player, Block block)
{ {
return !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !justAnimated(player); return !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()) && !justAnimated(player);
} }
public boolean checkFastBreak(Player player, Block block) public boolean checkFastBreak(Player player, Block block)