mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Fix issue #136
This commit is contained in:
1 parent
d338d4d1e2
commit
7ea8765212
3 files changed
+18
-5
No files matched your search
@@ -139,7 +139,7 @@ public class EntityListener extends EventListener {
|
||||
log("tried to sprint & damage too fast.", player, CheckType.FORCEFIELD);
|
||||
noHack = false;
|
||||
}
|
||||
if (checkManager.willCheck(player, CheckType.NO_SWING) && !backend.justAnimated(player)) {
|
||||
if (checkManager.willCheck(player, CheckType.NO_SWING) && !backend.justAnimated(player, event.getEntity())) {
|
||||
event.setCancelled(!config.silentMode());
|
||||
log("tried to damage an entity without swinging their arm.", player, CheckType.NO_SWING);
|
||||
noHack = false;
|
||||
|
||||
@@ -583,7 +583,7 @@ public class Backend {
|
||||
}
|
||||
}
|
||||
}
|
||||
return !justAnimated(player); // TODO: best way to implement other option?
|
||||
return !justAnimated(player, block); // TODO: best way to implement other option?
|
||||
}
|
||||
|
||||
public boolean checkFastBreak(Player player, Block block) {
|
||||
@@ -858,8 +858,18 @@ public class Backend {
|
||||
blockPunches.put(player.getName(), 0);
|
||||
}
|
||||
|
||||
public boolean justAnimated(Player player) {
|
||||
if (player.getItemInHand().containsEnchantment(Enchantment.DIG_SPEED)) { return true; }
|
||||
public boolean justAnimated(Player player, Block block) {
|
||||
if (player.getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) || (player.getItemInHand().getType() == Material.SHEARS && block.getType() == Material.LEAVES)) {
|
||||
return true;
|
||||
}
|
||||
return justAnimated(player);
|
||||
}
|
||||
|
||||
public boolean justAnimated(Player player, Entity e) {
|
||||
return justAnimated(player);
|
||||
}
|
||||
|
||||
private boolean justAnimated(Player player) {
|
||||
String name = player.getName();
|
||||
if (animated.containsKey(name)) {
|
||||
long time = System.currentTimeMillis() - animated.get(name);
|
||||
@@ -867,7 +877,7 @@ public class Backend {
|
||||
return time < magic.ANIMATION_MIN;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void logDamage(final Player player, int type) {
|
||||
|
||||
@@ -182,6 +182,9 @@ public final class Utilities {
|
||||
}
|
||||
|
||||
public static long calcSurvivalFastBreak(ItemStack tool, Material block) {
|
||||
if(isInstantBreak(block) || (tool.getType() == Material.SHEARS && block.getId() == Material.LEAVES.getId())) {
|
||||
return 0;
|
||||
}
|
||||
double bhardness = BlockHardness.getBlockHardness(block);
|
||||
double thardness = ToolHardness.getToolHardness(tool.getType());
|
||||
long enchantlvl = (long) tool.getEnchantmentLevel(Enchantment.DIG_SPEED);
|
||||
|
||||
Reference in new issue
Block a user