mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-04 06:28:52 +00:00
Let's see if we still need this dependency :D
This commit is contained in:
1 parent
8120050d39
commit
f850c3ab96
3 files changed
+46
-71
No files matched your search
@@ -46,12 +46,5 @@
|
|||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.gmail.nossr50</groupId>
|
|
||||||
<artifactId>mcMMO</artifactId>
|
|
||||||
<version>1.3.08</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@@ -294,7 +294,7 @@ public class Backend
|
|||||||
|
|
||||||
public boolean checkLongReachBlock(Player player, double x, double y, double z)
|
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)
|
public boolean checkLongReachDamage(double x, double y, double z)
|
||||||
@@ -745,71 +745,68 @@ public class Backend
|
|||||||
|
|
||||||
public boolean checkSwing(Player player, Block block)
|
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)
|
public boolean checkFastBreak(Player player, Block block)
|
||||||
{
|
{
|
||||||
if (!Utilities.isUsingMcMMOAbility(player))
|
int violations = FASTBREAK_MAXVIOLATIONS;
|
||||||
|
if (player.getGameMode() == GameMode.CREATIVE)
|
||||||
{
|
{
|
||||||
int violations = FASTBREAK_MAXVIOLATIONS;
|
violations = FASTBREAK_MAXVIOLATIONS_CREATIVE;
|
||||||
if (player.getGameMode() == GameMode.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;
|
int i = blockPunches.get(name);
|
||||||
}
|
if (i < BLOCK_PUNCH_MIN)
|
||||||
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);
|
return true;
|
||||||
if (i < BLOCK_PUNCH_MIN)
|
|
||||||
{
|
|
||||||
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);
|
fastBreakViolation.put(name, 0);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
if (!blocksBroken.containsKey(name) || !lastBlockBroken.containsKey(name))
|
||||||
|
{
|
||||||
|
if (!lastBlockBroken.containsKey(name))
|
||||||
{
|
{
|
||||||
Long math = System.currentTimeMillis() - lastBlockBroken.get(name);
|
lastBlockBroken.put(name, System.currentTimeMillis());
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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);
|
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);
|
lastBlockBroken.put(name, System.currentTimeMillis());
|
||||||
Long math = System.currentTimeMillis() - lastBlockBroken.get(name);
|
blocksBroken.put(name, 0);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
package net.h31ix.anticheat.util;
|
package net.h31ix.anticheat.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.AbilityType;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
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;
|
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)
|
public static boolean isSubmersed(Player player)
|
||||||
{
|
{
|
||||||
return player.getLocation().getBlock().isLiquid() && player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
return player.getLocation().getBlock().isLiquid() && player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||||
|
|||||||
Reference in new issue
Block a user