Let's see if we still need this dependency :D

This commit is contained in:
h31ix committed 2012-09-09 14:19:51 -04:00
1 parent 8120050d39
commit f850c3ab96
3 files changed
+47 -72

No files matched your search

@@ -294,7 +294,7 @@ public class Backend
public boolean checkLongReachBlock(Player player, double x, double y, double z)
{
return !Utilities.isUsingMcMMOAbility(player) && (x >= BLOCK_MAX_DISTANCE || y > BLOCK_MAX_DISTANCE || z > BLOCK_MAX_DISTANCE);
return (x >= BLOCK_MAX_DISTANCE || y > BLOCK_MAX_DISTANCE || z > BLOCK_MAX_DISTANCE);
}
public boolean checkLongReachDamage(double x, double y, double z)
@@ -745,71 +745,68 @@ public class Backend
public boolean checkSwing(Player player, Block block)
{
return !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()) && !justAnimated(player) && !Utilities.isUsingMcMMOAbility(player) && !(player.getInventory().getItemInHand().getType() == Material.SHEARS && block.getType() == Material.LEAVES);
return !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !(player.getInventory().getItemInHand().getType() == Material.SHEARS && block.getType() == Material.LEAVES);
}
public boolean checkFastBreak(Player player, Block block)
{
if (!Utilities.isUsingMcMMOAbility(player))
int violations = FASTBREAK_MAXVIOLATIONS;
if (player.getGameMode() == GameMode.CREATIVE)
{
int violations = FASTBREAK_MAXVIOLATIONS;
if (player.getGameMode() == GameMode.CREATIVE)
violations = FASTBREAK_MAXVIOLATIONS_CREATIVE;
}
String name = player.getName();
if (!player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()) && !isInstantBreakExempt(player) && !(player.getInventory().getItemInHand().getType() == Material.SHEARS && block.getType() == Material.LEAVES))
{
if (blockPunches.get(name) != null && player.getGameMode() != GameMode.CREATIVE)
{
violations = FASTBREAK_MAXVIOLATIONS_CREATIVE;
}
String name = player.getName();
if (!player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()) && !isInstantBreakExempt(player) && !(player.getInventory().getItemInHand().getType() == Material.SHEARS && block.getType() == Material.LEAVES))
{
if (blockPunches.get(name) != null && player.getGameMode() != GameMode.CREATIVE)
int i = blockPunches.get(name);
if (i < BLOCK_PUNCH_MIN)
{
int i = blockPunches.get(name);
if (i < BLOCK_PUNCH_MIN)
{
return true;
}
return true;
}
if (!fastBreakViolation.containsKey(name))
}
if (!fastBreakViolation.containsKey(name))
{
fastBreakViolation.put(name, 0);
}
else
{
Long math = System.currentTimeMillis() - lastBlockBroken.get(name);
if (fastBreakViolation.get(name) > violations && math < FASTBREAK_MAXVIOLATIONTIME)
{
lastBlockBroken.put(name, System.currentTimeMillis());
player.sendMessage(ChatColor.RED + "[AntiCheat] Fastbreaking detected. Please wait 10 seconds before breaking blocks.");
return true;
}
else if (fastBreakViolation.get(name) > 0 && math > FASTBREAK_MAXVIOLATIONTIME)
{
fastBreakViolation.put(name, 0);
}
else
}
if (!blocksBroken.containsKey(name) || !lastBlockBroken.containsKey(name))
{
if (!lastBlockBroken.containsKey(name))
{
Long math = System.currentTimeMillis() - lastBlockBroken.get(name);
if (fastBreakViolation.get(name) > violations && math < FASTBREAK_MAXVIOLATIONTIME)
{
lastBlockBroken.put(name, System.currentTimeMillis());
player.sendMessage(ChatColor.RED + "[AntiCheat] Fastbreaking detected. Please wait 10 seconds before breaking blocks.");
return true;
}
else if (fastBreakViolation.get(name) > 0 && math > FASTBREAK_MAXVIOLATIONTIME)
{
fastBreakViolation.put(name, 0);
}
lastBlockBroken.put(name, System.currentTimeMillis());
}
if (!blocksBroken.containsKey(name) || !lastBlockBroken.containsKey(name))
blocksBroken.put(name, 0);
}
else
{
blocksBroken.put(name, blocksBroken.get(name) + 1);
Long math = System.currentTimeMillis() - lastBlockBroken.get(name);
if (blocksBroken.get(name) > FASTBREAK_LIMIT && math < FASTBREAK_TIMEMAX)
{
if (!lastBlockBroken.containsKey(name))
{
lastBlockBroken.put(name, System.currentTimeMillis());
}
blocksBroken.put(name, 0);
lastBlockBroken.put(name, System.currentTimeMillis());
fastBreakViolation.put(name, fastBreakViolation.get(name) + 1);
return true;
}
else
else if (blocksBroken.get(name) > FASTBREAK_LIMIT)
{
blocksBroken.put(name, blocksBroken.get(name) + 1);
Long math = System.currentTimeMillis() - lastBlockBroken.get(name);
if (blocksBroken.get(name) > FASTBREAK_LIMIT && math < FASTBREAK_TIMEMAX)
{
blocksBroken.put(name, 0);
lastBlockBroken.put(name, System.currentTimeMillis());
fastBreakViolation.put(name, fastBreakViolation.get(name) + 1);
return true;
}
else if (blocksBroken.get(name) > FASTBREAK_LIMIT)
{
lastBlockBroken.put(name, System.currentTimeMillis());
blocksBroken.put(name, 0);
}
lastBlockBroken.put(name, System.currentTimeMillis());
blocksBroken.put(name, 0);
}
}
}
@@ -18,8 +18,6 @@
package net.h31ix.anticheat.util;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.mcMMO;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -110,19 +108,6 @@ public final class Utilities
return block.getType() == lily || block.getRelative(BlockFace.NORTH).getType() == lily || block.getRelative(BlockFace.SOUTH).getType() == lily || block.getRelative(BlockFace.EAST).getType() == lily || block.getRelative(BlockFace.WEST).getType() == lily;
}
public static boolean isUsingMcMMOAbility(Player player)
{
boolean b = false;
if (player.getServer().getPluginManager().getPlugin("mcMMO") != null)
{
if (mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.TREE_FELLER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BERSERK) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BLAST_MINING))
{
b = true;
}
}
return b;
}
public static boolean isSubmersed(Player player)
{
return player.getLocation().getBlock().isLiquid() && player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();