mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-04 06:28:52 +00:00
Also added extra KillAura check and fixed compatibility issues
This commit is contained in:
1 parent
7c9a05ff92
commit
661718d001
11 files changed
+155
-50
No files matched your search
@@ -33,7 +33,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
import com.comphenix.protocol.ProtocolManager;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
|
||||||
import com.rammelkast.anticheatreloaded.command.CommandHandler;
|
import com.rammelkast.anticheatreloaded.command.CommandHandler;
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
@@ -98,7 +97,6 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
// Enable packetlisteners
|
// Enable packetlisteners
|
||||||
BlinkCheck.startTimer();
|
BlinkCheck.startTimer();
|
||||||
BlinkCheck.listenPackets();
|
BlinkCheck.listenPackets();
|
||||||
KillAuraCheck.listenPackets();
|
|
||||||
|
|
||||||
updateManager = new UpdateManager();
|
updateManager = new UpdateManager();
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,7 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check;
|
package com.rammelkast.anticheatreloaded.check;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -291,7 +289,8 @@ public class Backend {
|
|||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
||||||
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isInWater(player)
|
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isInWater(player)
|
||||||
&& !Utilities.isInWeb(player)) {
|
&& !Utilities.isInWeb(player)
|
||||||
|
&& !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")) {
|
||||||
if (player.getFallDistance() == 0) {
|
if (player.getFallDistance() == 0) {
|
||||||
if (nofallViolation.get(uuid) == null) {
|
if (nofallViolation.get(uuid) == null) {
|
||||||
nofallViolation.put(uuid, 1);
|
nofallViolation.put(uuid, 1);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.combat;
|
package com.rammelkast.anticheatreloaded.check.combat;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -29,33 +28,31 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.checkassist.KillauraAssist;
|
import com.rammelkast.anticheatreloaded.util.checkassist.KillauraAssist;
|
||||||
|
|
||||||
public class KillAuraCheck {
|
public class KillAuraCheck {
|
||||||
|
|
||||||
|
// Angle check
|
||||||
public static final Map<String, Integer> ANGLE_FLAGS = new HashMap<String, Integer>();
|
public static final Map<String, Integer> ANGLE_FLAGS = new HashMap<String, Integer>();
|
||||||
|
// Heuristic fight speed check
|
||||||
public static final Map<String, Integer> DEVIATION_SCORES = new HashMap<String, Integer>();
|
public static final Map<String, Integer> DEVIATION_SCORES = new HashMap<String, Integer>();
|
||||||
public static final Map<String, Integer> DIFF_MAP = new HashMap<String, Integer>();
|
public static final Map<String, Integer> DIFF_MAP = new HashMap<String, Integer>();
|
||||||
public static final Map<String, ClickSpeed> CLICKSPEED_MAP = new HashMap<String, ClickSpeed>();
|
public static final Map<String, ClickSpeed> CLICKSPEED_MAP = new HashMap<String, ClickSpeed>();
|
||||||
|
// Heuristic aimbot check
|
||||||
|
public static final Map<String, List<Float>> PITCH_MOVEMENTS_CACHE = new HashMap<String, List<Float>>();
|
||||||
|
public static final Map<String, Float> GCD_CACHE = new HashMap<String, Float>();
|
||||||
|
// Not used as of now, code not committed yet
|
||||||
private static final KillauraAssist KILLAURA_ASSIST;
|
private static final KillauraAssist KILLAURA_ASSIST;
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static void listenPackets() {
|
|
||||||
/*AntiCheatReloaded.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(),
|
|
||||||
ListenerPriority.LOWEST, new PacketType[] { PacketType.Play.Client.POSITION_LOOK }) {
|
|
||||||
@Override
|
|
||||||
public void onPacketReceiving(PacketEvent e) {
|
|
||||||
Player player = e.getPlayer();
|
|
||||||
PacketContainer packet = e.getPacket();
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CheckResult checkAngle(Player player, EntityDamageEvent event) {
|
public static CheckResult checkAngle(Player player, EntityDamageEvent event) {
|
||||||
|
String uuid = player.getUniqueId().toString();
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
LivingEntity living = (LivingEntity) entity;
|
LivingEntity living = (LivingEntity) entity;
|
||||||
@@ -66,29 +63,30 @@ public class KillAuraCheck {
|
|||||||
|
|
||||||
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||||
if (Math.round(angleDifference) > AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_DIFFERENCE()) {
|
if (Math.round(angleDifference) > AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_DIFFERENCE()) {
|
||||||
if (!ANGLE_FLAGS.containsKey(player.getUniqueId().toString())) {
|
if (!ANGLE_FLAGS.containsKey(uuid)) {
|
||||||
ANGLE_FLAGS.put(player.getUniqueId().toString(), 1);
|
ANGLE_FLAGS.put(uuid, 1);
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int flags = ANGLE_FLAGS.get(player.getUniqueId().toString());
|
int flags = ANGLE_FLAGS.get(uuid);
|
||||||
if (flags >= AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_VIOLATIONS()) {
|
if (flags >= AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_VIOLATIONS()) {
|
||||||
ANGLE_FLAGS.remove(player.getUniqueId().toString());
|
ANGLE_FLAGS.remove(uuid);
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
return new CheckResult(CheckResult.Result.FAILED, "tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
ANGLE_FLAGS.put(player.getUniqueId().toString(), flags + 1);
|
ANGLE_FLAGS.put(uuid, flags + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CheckResult checkFightSpeed(Player player, EntityDamageEvent event) {
|
public static CheckResult checkFightSpeed(Player player, EntityDamageEvent event) {
|
||||||
if (!CLICKSPEED_MAP.containsKey(player.getUniqueId().toString())) {
|
String uuid = player.getUniqueId().toString();
|
||||||
CLICKSPEED_MAP.put(player.getUniqueId().toString(), new ClickSpeed());
|
if (!CLICKSPEED_MAP.containsKey(uuid)) {
|
||||||
|
CLICKSPEED_MAP.put(uuid, new ClickSpeed());
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
ClickSpeed clickSpeed = CLICKSPEED_MAP.get(player.getUniqueId().toString());
|
ClickSpeed clickSpeed = CLICKSPEED_MAP.get(uuid);
|
||||||
clickSpeed.registerClick();
|
clickSpeed.registerClick();
|
||||||
int deviationScore = clickSpeed.getDeviationScore();
|
int deviationScore = clickSpeed.getDeviationScore();
|
||||||
// Prevents false positives since scores under 2000 aren't reliable
|
// Prevents false positives since scores under 2000 aren't reliable
|
||||||
@@ -96,21 +94,21 @@ public class KillAuraCheck {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DEVIATION_SCORES.containsKey(player.getUniqueId().toString())) {
|
if (!DEVIATION_SCORES.containsKey(uuid)) {
|
||||||
DEVIATION_SCORES.put(player.getUniqueId().toString(), deviationScore);
|
DEVIATION_SCORES.put(uuid, deviationScore);
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
||||||
int lastScore = DEVIATION_SCORES.get(player.getUniqueId().toString());
|
int lastScore = DEVIATION_SCORES.get(uuid);
|
||||||
DEVIATION_SCORES.put(player.getUniqueId().toString(), deviationScore);
|
DEVIATION_SCORES.put(uuid, deviationScore);
|
||||||
int diff = Math.abs(deviationScore - lastScore);
|
int diff = Math.abs(deviationScore - lastScore);
|
||||||
if (!DIFF_MAP.containsKey(player.getUniqueId().toString())) {
|
if (!DIFF_MAP.containsKey(uuid)) {
|
||||||
DIFF_MAP.put(player.getUniqueId().toString(), diff);
|
DIFF_MAP.put(uuid, diff);
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
int lastDiff = DIFF_MAP.get(player.getUniqueId().toString());
|
int lastDiff = DIFF_MAP.get(uuid);
|
||||||
DIFF_MAP.put(player.getUniqueId().toString(), diff);
|
DIFF_MAP.put(uuid, diff);
|
||||||
if (Math.abs(diff - lastDiff) < magic.KILLAURA_FIGHTSPEED_MINDIFF()) {
|
if (Math.abs(diff - lastDiff) < magic.KILLAURA_FIGHTSPEED_MINDIFF()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "had a suspiciously consistant fighting speed (absdiff=" + Math.abs(diff - lastDiff) + ")");
|
return new CheckResult(CheckResult.Result.FAILED, "had a suspiciously consistant fighting speed (absdiff=" + Math.abs(diff - lastDiff) + ")");
|
||||||
@@ -118,6 +116,42 @@ public class KillAuraCheck {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check idea by Hawk AntiCheat (https://github.com/HawkAnticheat/Hawk)
|
||||||
|
*/
|
||||||
|
public static CheckResult checkAimbot(Player player, PlayerMoveEvent event) {
|
||||||
|
String uuid = player.getUniqueId().toString();
|
||||||
|
float pitchMovement = event.getTo().getPitch() - event.getFrom().getPitch();
|
||||||
|
if (!PITCH_MOVEMENTS_CACHE.containsKey(uuid)) {
|
||||||
|
PITCH_MOVEMENTS_CACHE.put(uuid, new ArrayList<Float>());
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
List<Float> pitchMovements = PITCH_MOVEMENTS_CACHE.get(uuid);
|
||||||
|
if (pitchMovement != 0 && Math.abs(pitchMovement) <= 10 && Math.abs(event.getTo().getPitch()) != 90) {
|
||||||
|
pitchMovements.add(Math.abs(pitchMovement));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pitchMovements.size() >= 20) {
|
||||||
|
float greatestCommonDivisor = Utilities.gcdRational(pitchMovements);
|
||||||
|
if (!GCD_CACHE.containsKey(uuid)) {
|
||||||
|
GCD_CACHE.put(uuid, greatestCommonDivisor);
|
||||||
|
}
|
||||||
|
|
||||||
|
float divisorDifference = Math.abs(greatestCommonDivisor - GCD_CACHE.get(uuid));
|
||||||
|
if (divisorDifference > 0.00425 || greatestCommonDivisor < 0.00001) {
|
||||||
|
pitchMovements.clear();
|
||||||
|
GCD_CACHE.put(uuid, greatestCommonDivisor);
|
||||||
|
PITCH_MOVEMENTS_CACHE.put(uuid, pitchMovements);
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "performed aimbot-like movements (divisor-diff=" + divisorDifference + ")");
|
||||||
|
}
|
||||||
|
pitchMovements.clear();
|
||||||
|
GCD_CACHE.put(uuid, greatestCommonDivisor);
|
||||||
|
PITCH_MOVEMENTS_CACHE.put(uuid, pitchMovements);
|
||||||
|
}
|
||||||
|
PITCH_MOVEMENTS_CACHE.put(uuid, pitchMovements);
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
private static class ClickSpeed {
|
private static class ClickSpeed {
|
||||||
private final List<Long> clicks;
|
private final List<Long> clicks;
|
||||||
private long lastClick;
|
private long lastClick;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class FlightCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMovingExempt(Player player) {
|
public static boolean isMovingExempt(Player player) {
|
||||||
return isDoing(player, MOVING_EXEMPT, -1);
|
return isDoing(player, MOVING_EXEMPT, -1) || player.isInsideVehicle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isDoing(Player player, Map<UUID, Long> map, double max) {
|
private static boolean isDoing(Player player, Map<UUID, Long> map, double max) {
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This check is an outdated mess which needs to be replaced
|
||||||
|
*/
|
||||||
public class SpeedCheck {
|
public class SpeedCheck {
|
||||||
|
|
||||||
public static final Map<UUID, Integer> SPEED_VIOLATIONS = new HashMap<UUID, Integer>();
|
public static final Map<UUID, Integer> SPEED_VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
@@ -73,9 +76,16 @@ public class SpeedCheck {
|
|||||||
&& ((player.getEyeLocation().getBlock().getRelative(BlockFace.UP).getType() != Material.AIR)
|
&& ((player.getEyeLocation().getBlock().getRelative(BlockFace.UP).getType() != Material.AIR)
|
||||||
&& (player.getEyeLocation().getBlock().getRelative(BlockFace.UP)
|
&& (player.getEyeLocation().getBlock().getRelative(BlockFace.UP)
|
||||||
.getType() != Material.CAVE_AIR))) {
|
.getType() != Material.CAVE_AIR))) {
|
||||||
reason = "while boosting on " + blockDownName.toLowerCase().replaceAll("_", " ") + " ";
|
if (player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")) {
|
||||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT()
|
reason = "while boosting on " + blockDownName.toLowerCase().replaceAll("_", " ")
|
||||||
+ (blockDownName.equals("BLUE_ICE") ? 0.20925D : 0.165D);
|
+ " and trapdoor";
|
||||||
|
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT()
|
||||||
|
+ (blockDownName.equals("BLUE_ICE") ? 0.35925D : 0.35D);
|
||||||
|
} else {
|
||||||
|
reason = "while boosting on " + blockDownName.toLowerCase().replaceAll("_", " ") + " ";
|
||||||
|
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT()
|
||||||
|
+ (blockDownName.equals("BLUE_ICE") ? 0.20925D : 0.2D);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
reason = "while sprinting ";
|
reason = "while sprinting ";
|
||||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT();
|
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT();
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ public class WaterWalkCheck {
|
|||||||
}
|
}
|
||||||
} else if (block.getRelative(BlockFace.DOWN).isLiquid()
|
} else if (block.getRelative(BlockFace.DOWN).isLiquid()
|
||||||
&& !AntiCheatReloaded.getManager().getBackend().isAscending(player) && Utilities.cantStandAt(block)
|
&& !AntiCheatReloaded.getManager().getBackend().isAscending(player) && Utilities.cantStandAt(block)
|
||||||
&& Utilities.cantStandAt(block.getRelative(BlockFace.DOWN))) {
|
&& Utilities.cantStandAt(block.getRelative(BlockFace.DOWN)) && (y < 0.025
|
||||||
|
|| y == 0.09999999999999964 || y == 0.14999999999999947 || y == 0.04999999999999982)) {
|
||||||
if (WATER_ASCENSION_VIOLATIONS.containsKey(uuid)) {
|
if (WATER_ASCENSION_VIOLATIONS.containsKey(uuid)) {
|
||||||
int v = WATER_ASCENSION_VIOLATIONS.get(uuid);
|
int v = WATER_ASCENSION_VIOLATIONS.get(uuid);
|
||||||
if (v >= AntiCheatReloaded.getManager().getBackend().getMagic().WATER_ASCENSION_VIOLATION_MAX()) {
|
if (v >= AntiCheatReloaded.getManager().getBackend().getMagic().WATER_ASCENSION_VIOLATION_MAX()) {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class CommandHelp extends CommandBase {
|
|||||||
private static final String[] HELP = {
|
private static final String[] HELP = {
|
||||||
GOLD + "/acr " + GRAY + "help",
|
GOLD + "/acr " + GRAY + "help",
|
||||||
GOLD + "/acr " + GRAY + "reload",
|
GOLD + "/acr " + GRAY + "reload",
|
||||||
|
GOLD + "/acr " + GRAY + "version",
|
||||||
GOLD + "/acr " + GRAY + "check " + WHITE + "[check] [on/off]",
|
GOLD + "/acr " + GRAY + "check " + WHITE + "[check] [on/off]",
|
||||||
GOLD + "/acr " + GRAY + "log " + WHITE + "[file/console] [on/off]",
|
GOLD + "/acr " + GRAY + "log " + WHITE + "[file/console] [on/off]",
|
||||||
GOLD + "/acr " + GRAY + "report " + WHITE + "[group/user]",
|
GOLD + "/acr " + GRAY + "report " + WHITE + "[group/user]",
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import org.bukkit.inventory.PlayerInventory;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
||||||
@@ -452,6 +453,12 @@ public class PlayerListener extends EventListener {
|
|||||||
user.setGoodLocation(event.getFrom());
|
user.setGoodLocation(event.getFrom());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (getCheckManager().willCheckQuick(player, CheckType.KILLAURA)) {
|
||||||
|
CheckResult result = KillAuraCheck.checkAimbot(player, event);
|
||||||
|
if (result.failed()) {
|
||||||
|
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import org.bukkit.util.NumberConversions;
|
|||||||
public final class Utilities {
|
public final class Utilities {
|
||||||
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
||||||
private static final List<Material> FOOD = new ArrayList<Material>();
|
private static final List<Material> FOOD = new ArrayList<Material>();
|
||||||
|
private static final List<Material> CLIMBABLE = new ArrayList<Material>();
|
||||||
private static final Map<Material, Material> COMBO = new HashMap<Material, Material>();
|
private static final Map<Material, Material> COMBO = new HashMap<Material, Material>();
|
||||||
|
|
||||||
public static final String SPY_METADATA = "ac-spydata";
|
public static final String SPY_METADATA = "ac-spydata";
|
||||||
@@ -287,8 +288,7 @@ public final class Utilities {
|
|||||||
* @return true if climbable
|
* @return true if climbable
|
||||||
*/
|
*/
|
||||||
public static boolean isClimbableBlock(Block block) {
|
public static boolean isClimbableBlock(Block block) {
|
||||||
return block.getType() == Material.VINE || block.getType() == Material.LADDER
|
return CLIMBABLE.contains(block.getType());
|
||||||
|| block.getType() == Material.WATER;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -399,8 +399,8 @@ public final class Utilities {
|
|||||||
/**
|
/**
|
||||||
* Determine if a block ISN'T one of the specified types
|
* Determine if a block ISN'T one of the specified types
|
||||||
*
|
*
|
||||||
* @param block block to check
|
* @param block block to check
|
||||||
* @param endTypes array of possible name endings
|
* @param endTypes array of possible name endings
|
||||||
* @return true if the block isn't any of the materials
|
* @return true if the block isn't any of the materials
|
||||||
*/
|
*/
|
||||||
public static boolean blockIsnt(Block block, String[] endTypes) {
|
public static boolean blockIsnt(Block block, String[] endTypes) {
|
||||||
@@ -504,6 +504,53 @@ public final class Utilities {
|
|||||||
return seconds;
|
return seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Code by Hawk Anticheat
|
||||||
|
* (https://github.com/HawkAnticheat/Hawk/blob/master/src/me/islandscout/hawk/util/MathPlus.java)
|
||||||
|
*
|
||||||
|
* @param a
|
||||||
|
* @param b
|
||||||
|
* @return the greatest common divisor between two floats
|
||||||
|
*/
|
||||||
|
public static float gcdRational(float a, float b) {
|
||||||
|
if (a == 0) {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
int quotient = getIntQuotient(b, a);
|
||||||
|
float remainder = ((b / a) - quotient) * a;
|
||||||
|
if (Math.abs(remainder) < Math.max(a, b) * 1E-3F)
|
||||||
|
remainder = 0;
|
||||||
|
return gcdRational(remainder, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Code by Hawk Anticheat
|
||||||
|
* (https://github.com/HawkAnticheat/Hawk/blob/master/src/me/islandscout/hawk/util/MathPlus.java)
|
||||||
|
*
|
||||||
|
* @param numbers
|
||||||
|
* @return the greatest common divisor between a list of floats
|
||||||
|
*/
|
||||||
|
public static float gcdRational(List<Float> numbers) {
|
||||||
|
float result = numbers.get(0);
|
||||||
|
for (int i = 1; i < numbers.size(); i++) {
|
||||||
|
result = gcdRational(numbers.get(i), result);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Code by Hawk Anticheat
|
||||||
|
* (https://github.com/HawkAnticheat/Hawk/blob/master/src/me/islandscout/hawk/util/MathPlus.java)
|
||||||
|
*
|
||||||
|
* @param dividend
|
||||||
|
* @param divisor
|
||||||
|
*/
|
||||||
|
public static int getIntQuotient(float dividend, float divisor) {
|
||||||
|
float ans = dividend / divisor;
|
||||||
|
float error = Math.max(dividend, divisor) * 1E-3F;
|
||||||
|
return (int) (ans + error);
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Start instant break materials
|
// Start instant break materials
|
||||||
INSTANT_BREAK.add(Material.COMPARATOR);
|
INSTANT_BREAK.add(Material.COMPARATOR);
|
||||||
@@ -549,7 +596,7 @@ public final class Utilities {
|
|||||||
INSTANT_BREAK.add(Material.TALL_SEAGRASS);
|
INSTANT_BREAK.add(Material.TALL_SEAGRASS);
|
||||||
INSTANT_BREAK.add(Material.WHEAT);
|
INSTANT_BREAK.add(Material.WHEAT);
|
||||||
// Start 1.14 objects
|
// Start 1.14 objects
|
||||||
if (VersionUtil.isOfVersion("v1_14")) {
|
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")) {
|
||||||
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
|
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
|
||||||
INSTANT_BREAK.add(Material.CORNFLOWER);
|
INSTANT_BREAK.add(Material.CORNFLOWER);
|
||||||
}
|
}
|
||||||
@@ -600,7 +647,7 @@ public final class Utilities {
|
|||||||
FOOD.add(Material.SPIDER_EYE);
|
FOOD.add(Material.SPIDER_EYE);
|
||||||
FOOD.add(Material.TROPICAL_FISH);
|
FOOD.add(Material.TROPICAL_FISH);
|
||||||
// Start 1.14 objects
|
// Start 1.14 objects
|
||||||
if (VersionUtil.isOfVersion("v1_14")) {
|
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")) {
|
||||||
FOOD.add(Material.SUSPICIOUS_STEW);
|
FOOD.add(Material.SUSPICIOUS_STEW);
|
||||||
FOOD.add(Material.SWEET_BERRIES);
|
FOOD.add(Material.SWEET_BERRIES);
|
||||||
}
|
}
|
||||||
@@ -636,5 +683,16 @@ public final class Utilities {
|
|||||||
COMBO.put(Material.STONE_SWORD, Material.COBWEB);
|
COMBO.put(Material.STONE_SWORD, Material.COBWEB);
|
||||||
COMBO.put(Material.WOODEN_SWORD, Material.COBWEB);
|
COMBO.put(Material.WOODEN_SWORD, Material.COBWEB);
|
||||||
// End combos
|
// End combos
|
||||||
|
|
||||||
|
// Start climbable
|
||||||
|
CLIMBABLE.add(Material.VINE);
|
||||||
|
CLIMBABLE.add(Material.LADDER);
|
||||||
|
CLIMBABLE.add(Material.WATER);
|
||||||
|
// Start 1.14 objects
|
||||||
|
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")) {
|
||||||
|
CLIMBABLE.add(Material.SCAFFOLDING);
|
||||||
|
}
|
||||||
|
// End 1.14 objects
|
||||||
|
// End climbable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,13 +19,10 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.util;
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|||||||
@@ -185,13 +185,13 @@ VELOCITY_SCHETIME: 2
|
|||||||
VELOCITY_TIME: 3
|
VELOCITY_TIME: 3
|
||||||
# Number of times a player can fail the ascension check while in water before being considered a cheater
|
# Number of times a player can fail the ascension check while in water before being considered a cheater
|
||||||
# Increase in case of false positives
|
# Increase in case of false positives
|
||||||
WATER_ASCENSION_VIOLATION_MAX: 12
|
WATER_ASCENSION_VIOLATION_MAX: 8
|
||||||
# Maximum speed that a player can climb a waterfall
|
# Maximum speed that a player can climb a waterfall
|
||||||
# Can be increased in case of false positives, shouldn't be necesary
|
# Can be increased in case of false positives, shouldn't be necesary
|
||||||
WATER_CLIMB_MAX: 0.15
|
WATER_CLIMB_MAX: 0.15
|
||||||
# Number of times a player can be caught speeding in water before being considered a cheater
|
# Number of times a player can be caught speeding in water before being considered a cheater
|
||||||
# Increase in case of false positives
|
# Increase in case of false positives
|
||||||
WATER_SPEED_VIOLATION_MAX: 4
|
WATER_SPEED_VIOLATION_MAX: 6
|
||||||
# Maximum speed a player can travel forwards or backwards
|
# Maximum speed a player can travel forwards or backwards
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||||
XZ_SPEED_MAX: 0.25
|
XZ_SPEED_MAX: 0.25
|
||||||
@@ -243,7 +243,7 @@ Y_SPEED_MAX: 0.5175
|
|||||||
Y_TIME: 800
|
Y_TIME: 800
|
||||||
# Amount of suspicious mid-air movements before a player is suspected of glide
|
# Amount of suspicious mid-air movements before a player is suspected of glide
|
||||||
# Increase this in case of false positives
|
# Increase this in case of false positives
|
||||||
GLIDE_LIMIT: 10
|
GLIDE_LIMIT: 8
|
||||||
# Maximum amount of movement packets allowed per second
|
# Maximum amount of movement packets allowed per second
|
||||||
# Increase this in case of false positives
|
# Increase this in case of false positives
|
||||||
BLINK_PACKET: 30
|
BLINK_PACKET: 30
|
||||||
|
|||||||
Reference in new issue
Block a user