mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 06:28:52 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15181ab6ad | ||
|
|
347eec8ff0 |
No files matched your search
@@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>net.gravitydevelopment.anticheat</groupId>
|
<groupId>net.gravitydevelopment.anticheat</groupId>
|
||||||
<artifactId>AntiCheat</artifactId>
|
<artifactId>AntiCheat</artifactId>
|
||||||
<version>1.5.6-ALPHA</version>
|
<version>1.6.0-ALPHA</version>
|
||||||
<name>AntiCheatReloaded</name>
|
<name>AntiCheatReloaded</name>
|
||||||
<url>https://rammelkast.com</url>
|
<url>https://rammelkast.com</url>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -170,8 +170,9 @@ public class Backend {
|
|||||||
inventoryTime.remove(pU);
|
inventoryTime.remove(pU);
|
||||||
inventoryClicks.remove(pU);
|
inventoryClicks.remove(pU);
|
||||||
lastFallPacket.remove(pU);
|
lastFallPacket.remove(pU);
|
||||||
GlideCheck.lastToFall.remove(pU);
|
GlideCheck.lastDiff.remove(pU);
|
||||||
GlideCheck.glideBuffer.remove(pU);
|
GlideCheck.lastFallDistance.remove(pU);
|
||||||
|
GlideCheck.violations.remove(pU);
|
||||||
SpeedCheck.speedViolation.remove(player.getUniqueId());
|
SpeedCheck.speedViolation.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,8 +778,9 @@ public class Backend {
|
|||||||
YAxisCheck.yAxisLastViolation.remove(player.getUniqueId());
|
YAxisCheck.yAxisLastViolation.remove(player.getUniqueId());
|
||||||
YAxisCheck.lastYcoord.remove(player.getUniqueId());
|
YAxisCheck.lastYcoord.remove(player.getUniqueId());
|
||||||
YAxisCheck.lastYtime.remove(player.getUniqueId());
|
YAxisCheck.lastYtime.remove(player.getUniqueId());
|
||||||
GlideCheck.lastToFall.remove(player.getUniqueId());
|
GlideCheck.lastFallDistance.remove(player.getUniqueId());
|
||||||
GlideCheck.glideBuffer.remove(player.getUniqueId());
|
GlideCheck.lastDiff.remove(player.getUniqueId());
|
||||||
|
GlideCheck.violations.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logExitFly(final Player player) {
|
public void logExitFly(final Player player) {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.gravitydevelopment.anticheat.check.movement;
|
package net.gravitydevelopment.anticheat.check.movement;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -11,119 +12,52 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||||
|
import net.gravitydevelopment.anticheat.check.Backend;
|
||||||
import net.gravitydevelopment.anticheat.check.CheckResult;
|
import net.gravitydevelopment.anticheat.check.CheckResult;
|
||||||
import net.gravitydevelopment.anticheat.util.Distance;
|
import net.gravitydevelopment.anticheat.util.Distance;
|
||||||
import net.gravitydevelopment.anticheat.util.Utilities;
|
import net.gravitydevelopment.anticheat.util.Utilities;
|
||||||
import net.gravitydevelopment.anticheat.util.VersionUtil;
|
import net.gravitydevelopment.anticheat.util.VersionUtil;
|
||||||
|
|
||||||
/**
|
|
||||||
* This is broken as f*ck
|
|
||||||
*/
|
|
||||||
public class GlideCheck {
|
public class GlideCheck {
|
||||||
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static Map<UUID, Double> lastToFall = new HashMap<UUID, Double>();
|
public static Map<UUID, Double> lastDiff = new HashMap<UUID, Double>();
|
||||||
public static Map<UUID, Integer> glideBuffer = new HashMap<UUID, Integer>();
|
public static Map<UUID, Float> lastFallDistance = new HashMap<UUID, Float>();
|
||||||
|
public static Map<UUID, Integer> violations = new HashMap<UUID, Integer>();
|
||||||
/*
|
|
||||||
* SOME OLD CODE
|
|
||||||
*
|
|
||||||
* UUID uuid = player.getUniqueId();
|
|
||||||
if(!lastYDelta.containsKey(uuid))
|
|
||||||
lastYDelta.put(uuid, 0.0);
|
|
||||||
if(!YAxisCheck.lastYcoord.containsKey(uuid))
|
|
||||||
YAxisCheck.lastYcoord.put(uuid, player.getLocation().getY());
|
|
||||||
double currentY = player.getLocation().getY();
|
|
||||||
double math = currentY - YAxisCheck.lastYcoord.get(uuid);
|
|
||||||
if((math < 0 && math > AntiCheat.getManager().getBackend().getMagic().GLIDE_MAX()) && !AntiCheat.getManager().getBackend().isMovingExempt(player))
|
|
||||||
{
|
|
||||||
if(math <= lastYDelta.get(uuid) && !(player.getEyeLocation().getBlock().getType() == Material.LADDER)
|
|
||||||
&& !Utilities.isInWater(player) && !Utilities.isInWeb(player)
|
|
||||||
&& Utilities.cantStandAt(player.getLocation().getBlock()) && !Utilities.cantStandAtSingle(player.getLocation().getBlock()) && !!Utilities.cantStandAtSingle(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
|
||||||
{
|
|
||||||
if(!glideBuffer.containsKey(uuid))
|
|
||||||
glideBuffer.put(uuid, 0);
|
|
||||||
int currentBuffer = glideBuffer.get(uuid);
|
|
||||||
glideBuffer.put(uuid, currentBuffer + 1);
|
|
||||||
if(currentBuffer >= AntiCheat.getManager().getBackend().getMagic().GLIDE_LIMIT())
|
|
||||||
{
|
|
||||||
double fallDist = distanceToFall(player.getLocation());
|
|
||||||
player.teleport(player.getLocation().add(0, -fallDist, 0));
|
|
||||||
player.setFallDistance((float) fallDist);
|
|
||||||
if(!AntiCheat.getManager().getBackend().silentMode())
|
|
||||||
{
|
|
||||||
player.sendMessage(ChatColor.RED + "[AntiCheat] Glide/Fly hacking detected.");
|
|
||||||
}
|
|
||||||
lastYDelta.put(uuid, math);
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED, uuid + " attempted to fall too slowly!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
glideBuffer.remove(uuid);
|
|
||||||
}
|
|
||||||
lastYDelta.put(uuid, math);*/
|
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
/* UUID uuid = player.getUniqueId();
|
if (VersionUtil.isFlying(player)) {
|
||||||
if (AntiCheat.getManager().getBackend().isMovingExempt(player) || VersionUtil.isFlying(player)) {
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
if (!lastDiff.containsKey(player.getUniqueId())) {
|
||||||
if(!YAxisCheck.lastYcoord.containsKey(uuid)) {
|
lastDiff.put(player.getUniqueId(), distance.getYDifference());
|
||||||
YAxisCheck.lastYcoord.put(uuid, player.getLocation().getY());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!YAxisCheck.lastYtime.containsKey(uuid)) {
|
|
||||||
YAxisCheck.lastYtime.put(uuid, System.currentTimeMillis());
|
|
||||||
}
|
|
||||||
|
|
||||||
double currentY = player.getLocation().getY();
|
|
||||||
double diff = currentY - YAxisCheck.lastYcoord.get(uuid);
|
|
||||||
double glideMax = AntiCheat.getManager().getBackend().getMagic().GLIDE_MAX();
|
|
||||||
long timeDiff = System.currentTimeMillis() - YAxisCheck.lastYtime.get(uuid);
|
|
||||||
|
|
||||||
if (diff <= glideMax || diff >= 0) {
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
if (!lastFallDistance.containsKey(player.getUniqueId())) {
|
||||||
if (!(!(player.getEyeLocation().getBlock().getType() == Material.LADDER)
|
lastFallDistance.put(player.getUniqueId(), player.getFallDistance());
|
||||||
|| !Utilities.isInWater(player) || !Utilities.isInWeb(player)
|
|
||||||
|| Utilities.cantStandAt(player.getLocation().getBlock()) || !Utilities.cantStandAtSingle(player.getLocation().getBlock()) || !Utilities.cantStandAtSingle(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))) {
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
double yDiff = distance.getYDifference();
|
||||||
if (timeDiff <= 150/) {
|
float fallDistance = player.getFallDistance();
|
||||||
return PASS;
|
if (yDiff == lastDiff.get(player.getUniqueId()) && fallDistance > lastFallDistance.get(player.getUniqueId())) {
|
||||||
}
|
if (!violations.containsKey(player.getUniqueId())) {
|
||||||
|
violations.put(player.getUniqueId(), 1);
|
||||||
if(!lastToFall.containsKey(uuid)) {
|
} else {
|
||||||
lastToFall.put(uuid, distanceToFall(player.getLocation()));
|
if (violations.get(player.getUniqueId()) + 1 >= AntiCheat.getManager().getBackend().getMagic().GLIDE_LIMIT()) {
|
||||||
} else {
|
violations.remove(player.getUniqueId());
|
||||||
double lastFall = lastToFall.get(uuid);
|
Location to = player.getLocation();
|
||||||
if (distanceToFall(player.getLocation()) + diff >= lastFall - 0.10125) {
|
to.setY(to.getY() - distanceToFall(to));
|
||||||
if (!glideBuffer.containsKey(uuid)) {
|
player.teleport(to);
|
||||||
glideBuffer.put(uuid, 1);
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
|
player.getName() + " was set back for gliding (yDiff=" + new BigDecimal(yDiff).setScale(2, BigDecimal.ROUND_UP) + ")");
|
||||||
} else {
|
} else {
|
||||||
int buffer = glideBuffer.get(uuid);
|
violations.put(player.getUniqueId(), violations.get(player.getUniqueId()) + 1);
|
||||||
if (buffer >= AntiCheat.getManager().getBackend().getMagic().GLIDE_LIMIT()) {
|
|
||||||
glideBuffer.remove(uuid);
|
|
||||||
if(!AntiCheat.getManager().getBackend().silentMode())
|
|
||||||
{
|
|
||||||
double fallDist = distanceToFall(player.getLocation());
|
|
||||||
player.teleport(player.getLocation().add(0, -fallDist, 0));
|
|
||||||
player.setFallDistance((float) fallDist);
|
|
||||||
}
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED, uuid + " attempted to glide!");
|
|
||||||
} else {
|
|
||||||
glideBuffer.put(uuid, buffer + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
lastDiff.put(player.getUniqueId(), distance.getYDifference());
|
||||||
System.out.println(diff + ":" + timeDiff + ":" + distanceToFall(player.getLocation()));
|
lastFallDistance.put(player.getUniqueId(), player.getFallDistance());
|
||||||
*/
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,10 +161,6 @@ public interface Magic {
|
|||||||
* Number of times a player can be caught in-glide before action is taken; Type=INTEGER, Leniency=INCREASE.
|
* Number of times a player can be caught in-glide before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int GLIDE_LIMIT();
|
public int GLIDE_LIMIT();
|
||||||
/**
|
|
||||||
* The max fallspeed after which glide check is disabled; Type=DOUBLE
|
|
||||||
*/
|
|
||||||
public double GLIDE_MAX();
|
|
||||||
/**
|
/**
|
||||||
* How many blocks you can travel before action is taken; Type=INTEGER, Leniency=INCREASE.
|
* How many blocks you can travel before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ Y_MAXVIOTIME: 5500
|
|||||||
Y_SPEED_MAX: 0.5125
|
Y_SPEED_MAX: 0.5125
|
||||||
Y_TIME: 800
|
Y_TIME: 800
|
||||||
GLIDE_LIMIT: 10
|
GLIDE_LIMIT: 10
|
||||||
GLIDE_MAX: -3.89425
|
|
||||||
KILLAURA_BOTHITS: 4
|
KILLAURA_BOTHITS: 4
|
||||||
BLINK_PACKET: 74
|
BLINK_PACKET: 74
|
||||||
VELOCITY_AMT: 5
|
VELOCITY_AMT: 5
|
||||||
Reference in new issue
Block a user