added files.
This commit is contained in:
commit
d04e1c435e
177 files changed
+14399
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class AttackSampleWindow {
|
||||
private final List intervalsMillis = Collections.synchronizedList(new ArrayList());
|
||||
private long lastSampleMillis = System.currentTimeMillis();
|
||||
|
||||
public AttackSampleWindow() {
|
||||
}
|
||||
|
||||
private void recordSample() {
|
||||
long now = System.currentTimeMillis();
|
||||
this.intervalsMillis.add(now - this.lastSampleMillis);
|
||||
this.lastSampleMillis = now;
|
||||
}
|
||||
|
||||
static void record(AttackSampleWindow attackSampleWindow) {
|
||||
attackSampleWindow.recordSample();
|
||||
}
|
||||
|
||||
public static List getIntervals(AttackSampleWindow attackSampleWindow) {
|
||||
return attackSampleWindow.intervalsMillis;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public abstract class CombatCheckModule {
|
||||
protected final Consumer<CombatModuleViolation> violationConsumer;
|
||||
private final KillauraPlayerData playerData;
|
||||
|
||||
public CombatCheckModule(Consumer<CombatModuleViolation> consumer, KillauraPlayerData data) {
|
||||
this.violationConsumer = consumer;
|
||||
this.playerData = data;
|
||||
}
|
||||
|
||||
protected boolean isCombatCheckReady() {
|
||||
return this.playerData.combatReadySupplier.getAsBoolean();
|
||||
}
|
||||
|
||||
public abstract void onPacket(PacketEvent event, long ticks);
|
||||
|
||||
public abstract void onPlayerMove(PlayerMoveEvent event, long ticks);
|
||||
|
||||
public abstract void onEntityDamage(EntityDamageByEntityEvent event, long ticks);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public final class CombatModuleNames extends HashMap<Class<? extends CombatCheckModule>, String> {
|
||||
public CombatModuleNames() {
|
||||
this.put(KillauraModuleA1.class, "A1");
|
||||
this.put(KillauraModuleA2.class, "A2");
|
||||
this.put(KillauraModuleA3.class, "A3");
|
||||
this.put(KillauraModuleA4.class, "A4");
|
||||
this.put(KillauraModuleA5.class, "A5");
|
||||
this.put(KillauraModuleA6.class, "A6");
|
||||
this.put(KillauraModuleB1.class, "B1");
|
||||
this.put(KillauraModuleB2.class, "B2");
|
||||
this.put(KillauraModuleB3.class, "B3");
|
||||
this.put(KillauraModuleB4.class, "B4");
|
||||
this.put(KillauraModuleB5.class, "B5");
|
||||
this.put(KillauraModuleB6.class, "B6");
|
||||
this.put(KillauraModuleB7.class, "B7");
|
||||
this.put(KillauraModuleC1.class, "C1");
|
||||
this.put(KillauraModuleC2.class, "C2");
|
||||
this.put(KillauraModuleC3.class, "C3");
|
||||
this.put(KillauraModuleC4.class, "C4");
|
||||
this.put(KillauraModuleC5.class, "C5");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
public class CombatModuleViolation {
|
||||
private final ViolationTier tier;
|
||||
private final String description;
|
||||
|
||||
public CombatModuleViolation(ViolationTier violationTier, String str) {
|
||||
this.tier = violationTier;
|
||||
this.description = str;
|
||||
}
|
||||
|
||||
public ViolationTier getTier() {
|
||||
return this.tier;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.Check;
|
||||
import me.konsolas.aac.checks.CheckManager;
|
||||
import me.konsolas.aac.checks.CheckPlayerData;
|
||||
import me.konsolas.aac.checks.PlayerData;
|
||||
import me.konsolas.aac.checks.movement.MovementTransition;
|
||||
import me.konsolas.aac.compat.CollisionBoxAccess;
|
||||
import me.konsolas.aac.movement.EntityDimensions;
|
||||
import me.konsolas.aac.movement.MovementResolution;
|
||||
import me.konsolas.aac.util.BoundingBox;
|
||||
import me.konsolas.aac.util.EnvironmentBlockChecks;
|
||||
import me.konsolas.aac.util.MaterialGroup;
|
||||
import me.konsolas.aac.util.RelativeBlockAccess;
|
||||
import me.konsolas.aac.api.HackType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Criticals extends Check {
|
||||
public Criticals(CheckManager checkManager) {
|
||||
super(checkManager, HackType.CRITICALS, CheckPlayerData::new, null, true, (player, data) -> true);
|
||||
}
|
||||
|
||||
private boolean canDealCriticalHit(Player player) {
|
||||
return player.getFallDistance() > 0.0F
|
||||
&& !player.isOnGround()
|
||||
&& !player.isInsideVehicle()
|
||||
&& !player.hasPotionEffect(PotionEffectType.BLINDNESS)
|
||||
&& !EnvironmentBlockChecks.isOnClimbable(new RelativeBlockAccess(player.getLocation()))
|
||||
&& !EnvironmentBlockChecks.isInLiquid(new RelativeBlockAccess(player.getLocation()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovementResolution move(Player player, PlayerData playerData, MovementTransition movementTransition) {
|
||||
Vector vector = movementTransition.getFrom().toVector();
|
||||
Player player2 = player;
|
||||
BoundingBox box = new BoundingBox(vector, EntityDimensions.forEntity(player2));
|
||||
if (CollisionBoxAccess.anyBlockMatches(
|
||||
player.getWorld(), box, block -> block.getType().isBlock() || block.getType() == MaterialGroup.COBWEB.getMaterial() || block.isLiquid()
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (CollisionBoxAccess.anyBlockMatches(
|
||||
player.getWorld(), box.expand(1.0, 1.0, 1.0), block -> block.getType() == Material.SLIME_BLOCK
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (PotionEffect potionEffect : player.getActivePotionEffects()) {
|
||||
if (potionEffect.getType().equals(PotionEffectType.JUMP)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
for (Entity entity : player.getNearbyEntities(2.0, 2.0, 2.0)) {
|
||||
if (entity instanceof Boat) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
String str = "check_minijump";
|
||||
if (this.getBooleanOption(str) && movementTransition.getFromGroundState().isOnGround()) {
|
||||
double y = movementTransition.getTo().getY() - movementTransition.getFrom().getY();
|
||||
if (y > 0.0 && y < 0.2) {
|
||||
double y2 = playerData.getMovementState().lastVelocity.getY();
|
||||
if (y2 > 0.0 && y2 < 0.2) {
|
||||
String str2 = "tried to do a mini-jump";
|
||||
byte b = 2;
|
||||
Player player3 = player;
|
||||
return this.addViolation(player3, b, str2) ? MovementResolution.setback() : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Player player, PlayerData playerData, EntityDamageByEntityEvent event) {
|
||||
Killaura.unusedFlag();
|
||||
Location location = player.getLocation();
|
||||
Player player2 = player;
|
||||
boolean flag = CollisionBoxAccess.isOnBlockSurface(player2, location);
|
||||
Player player3 = player;
|
||||
if (this.shouldMitigate(player3)) {
|
||||
event.setCancelled(true);
|
||||
} else {
|
||||
if (this.canDealCriticalHit(player) && flag) {
|
||||
String str = "tried to perform a critical hit whilst on the ground";
|
||||
byte b = 2;
|
||||
Player player4 = player;
|
||||
if (this.addViolation(player4, b, str)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.Check;
|
||||
import me.konsolas.aac.checks.CheckManager;
|
||||
import me.konsolas.aac.checks.PlayerData;
|
||||
import me.konsolas.aac.compat.ProtocolVersion;
|
||||
import me.konsolas.aac.api.HackType;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class FastBow extends Check {
|
||||
public FastBow(CheckManager checkManager) {
|
||||
super(checkManager, HackType.FASTBOW, FastBowPlayerData::new, null, true, (player, data) -> true);
|
||||
}
|
||||
|
||||
private long getExpectedDrawTimeMillis(double d) {
|
||||
return (long)(100.0 + 950.0 * d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerInteract(Player player, PlayerData playerData, PlayerInteractEvent event) {
|
||||
Killaura.unusedFlag();
|
||||
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
FastBowPlayerData data = (FastBowPlayerData)playerData.getCheckData(HackType.FASTBOW);
|
||||
data.lastInteractMillis = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityShootBow(Player player, PlayerData playerData, EntityShootBowEvent event) {
|
||||
Killaura.unusedFlag();
|
||||
FastBowPlayerData data = (FastBowPlayerData)playerData.getCheckData(HackType.FASTBOW);
|
||||
if (!ProtocolVersion.getServerVersion().isAtLeast(ProtocolVersion.V1_14) || event.getBow() == null || event.getBow().getType() != Material.CROSSBOW) {
|
||||
Player player2 = player;
|
||||
if (this.shouldMitigate(player2)) {
|
||||
event.setCancelled(true);
|
||||
} else {
|
||||
double d = event.getForce();
|
||||
long ticks = this.getExpectedDrawTimeMillis(d);
|
||||
String str = "lenience";
|
||||
long ticks2 = ticks - this.getLongOption(str);
|
||||
long now = System.currentTimeMillis() - data.lastInteractMillis;
|
||||
if (now >= ticks2) {
|
||||
data.lastInteractMillis = System.currentTimeMillis();
|
||||
} else if (ticks2 > 200L) {
|
||||
int value = (int)(1L + Math.abs((now - ticks2) / 90L));
|
||||
String str2 = "shooting arrows too quickly (" + now + "/" + ticks2 + " ms)";
|
||||
int value2 = value;
|
||||
Player player3 = player;
|
||||
if (this.addViolation(player3, value2, str2)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.CheckPlayerData;
|
||||
public class FastBowPlayerData extends CheckPlayerData {
|
||||
public long lastInteractMillis;
|
||||
|
||||
public FastBowPlayerData() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.Check;
|
||||
import me.konsolas.aac.checks.CheckManager;
|
||||
import me.konsolas.aac.checks.PlayerData;
|
||||
import me.konsolas.aac.api.HackType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
|
||||
public class FastUse extends Check {
|
||||
public FastUse(CheckManager checkManager) {
|
||||
super(checkManager, HackType.FASTUSE, () -> new FastUsePlayerData(null), null, true, (player, data) -> true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerInteract(Player player, PlayerData playerData, PlayerInteractEvent event) {
|
||||
FastUsePlayerData data = (FastUsePlayerData)playerData.getCheckData(HackType.FASTUSE);
|
||||
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
data.lastInteractMillis = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerItemConsume(Player player, PlayerData playerData, PlayerItemConsumeEvent event) {
|
||||
FastUsePlayerData data = (FastUsePlayerData)playerData.getCheckData(HackType.FASTUSE);
|
||||
Player player2 = player;
|
||||
if (this.shouldMitigate(player2)) {
|
||||
event.setCancelled(true);
|
||||
} else {
|
||||
long now = System.currentTimeMillis() - data.lastInteractMillis;
|
||||
String str = "min_consumption_time";
|
||||
if (now < this.getLongOption(str)) {
|
||||
String str2 = "consumed " + event.getItem().getType().name() + " too quickly (" + now + " ms)";
|
||||
byte b = 1;
|
||||
Player player3 = player;
|
||||
if (this.addViolation(player3, b, str2)) {
|
||||
event.setCancelled(true);
|
||||
player.getInventory().setHeldItemSlot((player.getInventory().getHeldItemSlot() + 1) % 9);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.CheckPlayerData;
|
||||
public class FastUsePlayerData extends CheckPlayerData {
|
||||
public long lastInteractMillis;
|
||||
|
||||
private FastUsePlayerData() {
|
||||
}
|
||||
|
||||
public FastUsePlayerData(FastUseStateAccess fastUseStateAccess) {
|
||||
this();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
public class FastUseStateAccess {
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.Check;
|
||||
import me.konsolas.aac.checks.CheckManager;
|
||||
import me.konsolas.aac.checks.PlayerData;
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import com.comphenix.protocol.PacketType.Play.Client;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.Arrays;
|
||||
import me.konsolas.aac.api.HackType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FightSpeed extends Check {
|
||||
public FightSpeed(CheckManager checkManager) {
|
||||
super(checkManager, HackType.FIGHTSPEED, FightSpeedPlayerData::new, Arrays.asList(Client.ARM_ANIMATION, Client.USE_ENTITY), false, (player, data) -> true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(Player player2, PlayerData playerData, PacketEvent event) {
|
||||
Killaura.unusedFlag();
|
||||
FightSpeedPlayerData data2 = (FightSpeedPlayerData)playerData.getCheckData(HackType.FIGHTSPEED);
|
||||
if (PacketMathUtils.isAttackPacket(event.getPacket())) {
|
||||
AttackSampleWindow.record(data2.hitWindow);
|
||||
} else if (event.getPacketType() == Client.ARM_ANIMATION) {
|
||||
Player player3 = player2;
|
||||
if (this.manager.isPlayerSafeForCombatCheck(player3)) {
|
||||
AttackSampleWindow.record(data2.swingWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(long currentTick) {
|
||||
Killaura.unusedFlag();
|
||||
super.tick(currentTick);
|
||||
if (currentTick % 20L == 0L) {
|
||||
this.forAllPlayers((player, data) -> {
|
||||
long now = System.currentTimeMillis();
|
||||
FightSpeedPlayerData fsData = (FightSpeedPlayerData)data;
|
||||
long ticks = now - fsData.lastCheckMillis;
|
||||
fsData.lastCheckMillis = now;
|
||||
AttackSampleWindow attackSampleWindow = fsData.hitWindow;
|
||||
AttackSampleWindow attackSampleWindow2 = fsData.swingWindow;
|
||||
fsData.hitWindow = new AttackSampleWindow();
|
||||
fsData.swingWindow = new AttackSampleWindow();
|
||||
if (attackSampleWindow != null) {
|
||||
double d = AttackSampleWindow.getIntervals(attackSampleWindow).size() * 1000.0 / ticks;
|
||||
if (d > this.getIntOption("max_hit")) {
|
||||
int vl = Math.min(AttackSampleWindow.getIntervals(attackSampleWindow).size() - this.getIntOption("max_hit") + 2, 10);
|
||||
this.addViolation(player, vl, "attacked " + AttackSampleWindow.getIntervals(attackSampleWindow).size() + " times in " + ticks + "ms");
|
||||
}
|
||||
}
|
||||
|
||||
if (attackSampleWindow2 != null) {
|
||||
double d2 = AttackSampleWindow.getIntervals(attackSampleWindow2).size() * 1000.0 / ticks;
|
||||
if (d2 > this.getIntOption("max_swing")) {
|
||||
int vl = Math.min(AttackSampleWindow.getIntervals(attackSampleWindow2).size() - this.getIntOption("max_hit"), 10);
|
||||
this.addViolation(player, vl, "clicked " + AttackSampleWindow.getIntervals(attackSampleWindow2).size() + " times in " + ticks + "ms");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.CheckPlayerData;
|
||||
public class FightSpeedPlayerData extends CheckPlayerData {
|
||||
public AttackSampleWindow hitWindow = new AttackSampleWindow();
|
||||
public AttackSampleWindow swingWindow = new AttackSampleWindow();
|
||||
public long lastCheckMillis;
|
||||
|
||||
public FightSpeedPlayerData() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.Check;
|
||||
import me.konsolas.aac.checks.CheckManager;
|
||||
import me.konsolas.aac.checks.PlayerData;
|
||||
import me.konsolas.aac.checks.movement.MovementTransition;
|
||||
import me.konsolas.aac.compat.WorldRayTraceAccess;
|
||||
import me.konsolas.aac.movement.EntityDimensions;
|
||||
import me.konsolas.aac.movement.MovementResolution;
|
||||
import me.konsolas.aac.util.BlockRayTraceResult;
|
||||
import me.konsolas.aac.util.BoundingBox;
|
||||
import com.google.common.collect.EvictingQueue;
|
||||
import java.util.Optional;
|
||||
import me.konsolas.aac.api.HackType;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Hitbox extends Check {
|
||||
public Hitbox(CheckManager checkManager) {
|
||||
super(checkManager, HackType.HITBOX, HitboxPlayerData::new, null, true, (player, data) -> true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovementResolution move(Player player, PlayerData playerData, MovementTransition movementTransition) {
|
||||
HitboxPlayerData data = (HitboxPlayerData)playerData.getCheckData(HackType.HITBOX);
|
||||
if (HitboxPlayerData.getPositionHistory(data) == null) {
|
||||
String str = "buffer_size";
|
||||
HitboxPlayerData.setPositionHistory(data, EvictingQueue.create(this.getIntOption(str)));
|
||||
}
|
||||
|
||||
HitboxPlayerData.getPositionHistory(data).add(movementTransition.getFrom().toVector());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Player player, PlayerData playerData, EntityDamageByEntityEvent event) {
|
||||
if (event.getEntity().getVehicle() == null) {
|
||||
EvictingQueue<Vector> evictingQueue = null;
|
||||
if (event.getEntity() instanceof Player) {
|
||||
Player player2 = (Player)event.getEntity();
|
||||
Optional<HitboxPlayerData> optional = this.getPlayerData(player2).map(d -> (HitboxPlayerData)d.getCheckData(HackType.HITBOX));
|
||||
if (optional.isPresent()) {
|
||||
evictingQueue = HitboxPlayerData.getPositionHistory(optional.get());
|
||||
}
|
||||
}
|
||||
|
||||
Vector vector = player.getEyeLocation().toVector();
|
||||
Vector vector2 = player.getLocation().getDirection();
|
||||
String str = "max_reach";
|
||||
double d2 = this.getDoubleOption(str);
|
||||
String str2 = "check_walls";
|
||||
double d3;
|
||||
Material material;
|
||||
if (this.getBooleanOption(str2)) {
|
||||
BlockRayTraceResult blockRayTraceResult = WorldRayTraceAccess.rayTraceBlock(player, vector, vector2, d2 + 1.5);
|
||||
d3 = blockRayTraceResult.isHit() ? blockRayTraceResult.getHitPosition().distance(vector) : Double.POSITIVE_INFINITY;
|
||||
material = blockRayTraceResult.isHit() ? blockRayTraceResult.getBlockPosition().toLocation(player.getWorld()).getBlock().getType() : null;
|
||||
} else {
|
||||
d3 = Double.POSITIVE_INFINITY;
|
||||
material = null;
|
||||
}
|
||||
|
||||
if (evictingQueue != null && !evictingQueue.isEmpty()) {
|
||||
double d4;
|
||||
label94: {
|
||||
d4 = Double.POSITIVE_INFINITY;
|
||||
String str3 = "lenience";
|
||||
double d5 = this.getDoubleOption(str3);
|
||||
Vector vector3 = new Vector(d5, d5, d5);
|
||||
Entity entity = event.getEntity();
|
||||
EntityDimensions entityDimensions = EntityDimensions.forEntity(entity);
|
||||
BoundingBox box = new BoundingBox(event.getEntity().getLocation().toVector(), entityDimensions).expand(vector3);
|
||||
double d6 = box.rayTraceDistance(vector, vector2);
|
||||
if (!Double.isNaN(d6) && d6 < d4) {
|
||||
d4 = d6;
|
||||
if (d4 <= d2) {
|
||||
break label94;
|
||||
}
|
||||
}
|
||||
|
||||
for (Vector vector4 : evictingQueue) {
|
||||
BoundingBox box2 = new BoundingBox(vector4, entityDimensions).expand(vector3);
|
||||
double d7 = box2.rayTraceDistance(vector, vector2);
|
||||
if (!Double.isNaN(d7) && d7 < d4) {
|
||||
d4 = d7;
|
||||
if (d4 <= d2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Double.isFinite(d4)) {
|
||||
String str4 = "missed player hitbox in attack";
|
||||
byte b = 2;
|
||||
Player player3 = player;
|
||||
if (this.addViolation(player3, b, str4)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (d4 > d2) {
|
||||
String str5 = String.format("attacked player too far away (%.3f blocks)", d4);
|
||||
byte b2 = 3;
|
||||
Player player4 = player;
|
||||
if (this.addViolation(player4, b2, str5)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (d4 > d3) {
|
||||
String str6 = "attacked player through " + material;
|
||||
byte b3 = 2;
|
||||
Player player5 = player;
|
||||
if (this.addViolation(player5, b3, str6)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Vector vector5 = event.getEntity().getLocation().toVector();
|
||||
String str7 = "mob_lenience";
|
||||
double d8 = this.getDoubleOption(str7);
|
||||
Entity entity2 = event.getEntity();
|
||||
BoundingBox box3 = new BoundingBox(vector5, EntityDimensions.forEntity(entity2)).expand(d8, d8, d8);
|
||||
double d9 = box3.rayTraceDistance(vector, vector2);
|
||||
if (Double.isNaN(d9)) {
|
||||
String str8 = "missed entity hitbox in attack";
|
||||
byte b4 = 1;
|
||||
Player player6 = player;
|
||||
if (this.addViolation(player6, b4, str8)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (d9 > d2) {
|
||||
String str9 = String.format("attacked entity too far away (%.3f blocks)", d9);
|
||||
byte b5 = 1;
|
||||
Player player7 = player;
|
||||
if (this.addViolation(player7, b5, str9)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (d9 > d3) {
|
||||
String str10 = "attacked entity through " + material;
|
||||
byte b6 = 1;
|
||||
Player player8 = player;
|
||||
if (this.addViolation(player8, b6, str10)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.CheckPlayerData;
|
||||
import com.google.common.collect.EvictingQueue;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class HitboxPlayerData extends CheckPlayerData {
|
||||
private EvictingQueue<Vector> positionHistory;
|
||||
|
||||
public HitboxPlayerData() {
|
||||
}
|
||||
|
||||
public static EvictingQueue<Vector> getPositionHistory(HitboxPlayerData data) {
|
||||
return data.positionHistory;
|
||||
}
|
||||
|
||||
public static EvictingQueue<Vector> setPositionHistory(HitboxPlayerData data, EvictingQueue<Vector> evictingQueue) {
|
||||
return data.positionHistory = evictingQueue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.Check;
|
||||
import me.konsolas.aac.checks.CheckManager;
|
||||
import me.konsolas.aac.checks.PlayerData;
|
||||
import me.konsolas.aac.checks.movement.MovementTransition;
|
||||
import me.konsolas.aac.movement.MovementResolution;
|
||||
import com.comphenix.protocol.PacketType.Play.Client;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import me.konsolas.aac.api.HackType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class Killaura extends Check {
|
||||
private long currentTick;
|
||||
private static final Map<Class<? extends CombatCheckModule>, String> MODULE_NAMES = new CombatModuleNames();
|
||||
private final Map<Class<? extends CombatCheckModule>, Integer> enabledModules;
|
||||
|
||||
public Killaura(CheckManager checkManager) {
|
||||
super(
|
||||
checkManager,
|
||||
HackType.KILLAURA,
|
||||
KillauraPlayerData::new,
|
||||
Arrays.asList(
|
||||
Client.ENTITY_ACTION, Client.USE_ENTITY, Client.ARM_ANIMATION, Client.FLYING, Client.POSITION, Client.POSITION_LOOK, Client.LOOK
|
||||
),
|
||||
true,
|
||||
(player, data) -> true
|
||||
);
|
||||
this.enabledModules = new HashMap<>();
|
||||
|
||||
for (Class<? extends CombatCheckModule> classVal : MODULE_NAMES.keySet()) {
|
||||
String str = "modules." + MODULE_NAMES.get(classVal);
|
||||
int value = this.getIntOption(str);
|
||||
if (value >= 0) {
|
||||
this.enabledModules.put(classVal, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initKillauraData(Player player, KillauraPlayerData data) {
|
||||
if (KillauraPlayerData.getModules(data) == null) {
|
||||
KillauraPlayerData.setModules(data, this.enabledModules.keySet().stream().map(clazz -> {
|
||||
Consumer<CombatModuleViolation> violationConsumer = violation -> this.addViolation(
|
||||
player,
|
||||
this.enabledModules.get(clazz),
|
||||
MODULE_NAMES.get(clazz) + ": (" + violation.getTier() + ") " + violation.getDescription()
|
||||
);
|
||||
|
||||
try {
|
||||
return clazz.getConstructor(Consumer.class, KillauraPlayerData.class).newInstance(violationConsumer, data);
|
||||
} catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
if (data.combatReadySupplier == null) {
|
||||
data.combatReadySupplier = () -> this.manager.isPlayerSafeForCombatCheck(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(long currentTick) {
|
||||
super.tick(currentTick);
|
||||
this.currentTick = currentTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(Player player, PlayerData playerData, PacketEvent event) {
|
||||
KillauraPlayerData data = (KillauraPlayerData)playerData.getCheckData(HackType.KILLAURA);
|
||||
this.initKillauraData(player, data);
|
||||
|
||||
for (CombatCheckModule combatCheckModule : KillauraPlayerData.getModules(data)) {
|
||||
combatCheckModule.onPacket(event, this.currentTick);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovementResolution move(Player player, PlayerData playerData, MovementTransition movementTransition) {
|
||||
KillauraPlayerData data = (KillauraPlayerData)playerData.getCheckData(HackType.KILLAURA);
|
||||
this.initKillauraData(player, data);
|
||||
PlayerMoveEvent event = new PlayerMoveEvent(player, movementTransition.getFrom(), movementTransition.getTo());
|
||||
|
||||
for (CombatCheckModule combatCheckModule : KillauraPlayerData.getModules(data)) {
|
||||
combatCheckModule.onPlayerMove(event, this.currentTick);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Player player, PlayerData playerData, EntityDamageByEntityEvent event) {
|
||||
KillauraPlayerData data = (KillauraPlayerData)playerData.getCheckData(HackType.KILLAURA);
|
||||
this.initKillauraData(player, data);
|
||||
|
||||
for (CombatCheckModule combatCheckModule : KillauraPlayerData.getModules(data)) {
|
||||
combatCheckModule.onEntityDamage(event, this.currentTick);
|
||||
}
|
||||
|
||||
KillauraPlayerData.setLastAttackTick(data, this.currentTick);
|
||||
Player player2 = player;
|
||||
if (this.shouldMitigate(player2)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViolation(Player player, PlayerData playerData, HackType hackType, int i) {
|
||||
KillauraPlayerData data = (KillauraPlayerData)playerData.getCheckData(HackType.KILLAURA);
|
||||
this.initKillauraData(player, data);
|
||||
if (KillauraPlayerData.getLastAttackTick(data) + 20L > this.currentTick && hackType == HackType.MOVE && i < 50) {
|
||||
String str = "modules.D1";
|
||||
int value = this.getIntOption(str);
|
||||
if (value >= 0 && KillauraPlayerData.getMoveBuffer(data).record(this.currentTick)) {
|
||||
ViolationTier violationTier = KillauraPlayerData.getMoveBuffer(data).getCount() > 20
|
||||
? ViolationTier.HIGH
|
||||
: ViolationTier.MEDIUM;
|
||||
String str2 = "D1: (" + violationTier + ") u:" + i + " v: " + KillauraPlayerData.getMoveBuffer(data).getCount();
|
||||
int value2 = value;
|
||||
Player player2 = player;
|
||||
this.addViolation(player2, value2, str2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean unusedFlag() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleA1 extends CombatCheckModule {
|
||||
private int violations;
|
||||
private long lastDamageTick;
|
||||
private long invalidGcdTicks;
|
||||
private float lastDeltaYaw;
|
||||
|
||||
public KillauraModuleA1(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
if (this.lastDamageTick + 10L <= ticks) {
|
||||
if (this.lastDamageTick + 20L <= ticks) {
|
||||
this.invalidGcdTicks = 0L;
|
||||
}
|
||||
} else {
|
||||
float yaw = Math.abs(PacketMathUtils.wrapYawDelta(event.getFrom().getYaw(), event.getTo().getYaw()));
|
||||
float f = this.lastDeltaYaw;
|
||||
this.lastDeltaYaw = yaw;
|
||||
if (!(yaw < 0.25) && !(f < 0.25)) {
|
||||
double d = PacketMathUtils.gcd((long)(yaw * 1.6777216E7F), (long)(f * 1.6777216E7F)) / 1.6777216E7;
|
||||
if ((yaw / d % 1.0 != 0.0 || f / d % 1.0 != 0.0) && this.invalidGcdTicks <= 30L) {
|
||||
this.invalidGcdTicks++;
|
||||
} else {
|
||||
if (this.invalidGcdTicks > 30L) {
|
||||
this.violations++;
|
||||
if (this.violations > 12) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.HIGH, "t: " + this.invalidGcdTicks));
|
||||
} else if (this.violations > 7) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.MEDIUM, "t: " + this.invalidGcdTicks));
|
||||
} else if (this.violations > 5) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.LOW, "t: " + this.invalidGcdTicks));
|
||||
}
|
||||
} else {
|
||||
this.violations = Math.max(this.violations - 1, 0);
|
||||
}
|
||||
|
||||
this.invalidGcdTicks = 0L;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
this.lastDamageTick = ticks;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.PacketType.Play.Client;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleA2 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(100L, 5);
|
||||
private boolean tracking;
|
||||
private int distinctYaws;
|
||||
private int repeatedYaws;
|
||||
private long trackingStartMillis;
|
||||
private Map yawCounts = new HashMap();
|
||||
private long lastAttackTick;
|
||||
|
||||
public KillauraModuleA2(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
if (event.getPacketType().equals(Client.LOOK)) {
|
||||
this.reset();
|
||||
} else if (PacketMathUtils.isAttackPacket(event.getPacket())) {
|
||||
this.lastAttackTick = ticks;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
long now = System.currentTimeMillis();
|
||||
if (this.tracking && now - this.trackingStartMillis > 2000L) {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
if (this.lastAttackTick + 10L > ticks) {
|
||||
if (this.tracking) {
|
||||
if (now - this.trackingStartMillis > 2000L) {
|
||||
this.reset();
|
||||
}
|
||||
} else {
|
||||
this.tracking = true;
|
||||
this.trackingStartMillis = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
if (this.yawCounts.size() == this.distinctYaws && this.repeatedYaws < 1 && this.distinctYaws > 32 && this.buffer.record(ticks)) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.MEDIUM, "f: " + this.distinctYaws));
|
||||
}
|
||||
|
||||
float yaw = (float)PacketMathUtils.round(Math.abs(PacketMathUtils.wrapYawDelta(event.getFrom().getYaw(), event.getTo().getYaw())), 3);
|
||||
if (!this.yawCounts.containsKey(yaw)) {
|
||||
this.yawCounts.put(yaw, 1);
|
||||
this.distinctYaws++;
|
||||
} else {
|
||||
this.repeatedYaws++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
this.tracking = false;
|
||||
this.distinctYaws = 0;
|
||||
this.repeatedYaws = 0;
|
||||
this.yawCounts.clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleA3 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(12L, 6);
|
||||
|
||||
public KillauraModuleA3(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
float yaw = event.getTo().getYaw();
|
||||
float yaw2 = PacketMathUtils.wrapYawDelta(event.getFrom().getYaw(), yaw);
|
||||
if (yaw2 > 0.1
|
||||
&& (yaw2 % 0.5 == 0.0 || yaw % 1.0F == 0.0F)
|
||||
&& event.getPlayer().getVehicle() == null
|
||||
&& this.buffer.record(ticks)) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.HIGH, "dYaw: " + yaw2 + " to: " + yaw));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class KillauraModuleA4 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(20L, 3);
|
||||
|
||||
public KillauraModuleA4(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
Vector x = new Vector(event.getTo().getX() - event.getFrom().getX(), 0.0, event.getTo().getZ() - event.getFrom().getZ());
|
||||
Vector yaw = new Vector(event.getTo().getYaw() - event.getFrom().getYaw(), 0.0F, event.getTo().getYaw() - event.getFrom().getYaw());
|
||||
double d = x.distance(yaw);
|
||||
double d2 = x.length();
|
||||
if (d > 100000.0 && d2 > 0.2 && d2 < 1.0 && this.buffer.record(ticks)) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.HIGH, "d: " + d));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleA5 extends CombatCheckModule {
|
||||
private int steadyTicks;
|
||||
private float lastDeltaYaw;
|
||||
|
||||
public KillauraModuleA5(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
float yaw = Math.abs(PacketMathUtils.wrapYawDelta(event.getFrom().getYaw(), event.getTo().getYaw()));
|
||||
float pitch = event.getTo().getPitch() - event.getFrom().getPitch();
|
||||
float f = this.lastDeltaYaw;
|
||||
this.lastDeltaYaw = pitch;
|
||||
float f2 = pitch - f;
|
||||
if (f2 == 0.0F && event.getPlayer().getVehicle() == null && Math.abs(event.getTo().getPitch()) < 80.0F && yaw > 1.8) {
|
||||
if (this.steadyTicks++ > 30) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.HIGH, "dYaw: " + yaw));
|
||||
}
|
||||
} else {
|
||||
this.steadyTicks = Math.max(this.steadyTicks - 4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleA6 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(100L, 10);
|
||||
private float lastDeltaYaw;
|
||||
private float lastDeltaPitch;
|
||||
|
||||
public KillauraModuleA6(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
float pitch = event.getTo().getPitch() - event.getFrom().getPitch();
|
||||
float f = this.lastDeltaYaw;
|
||||
this.lastDeltaYaw = pitch;
|
||||
float yaw = PacketMathUtils.wrapYawDelta(event.getFrom().getYaw(), event.getTo().getYaw());
|
||||
float f2 = this.lastDeltaPitch;
|
||||
this.lastDeltaPitch = yaw;
|
||||
float f3 = yaw - f2;
|
||||
float f4 = pitch - f;
|
||||
if (f3 != 0.0F || f4 != 0.0F || event.getPlayer().getVehicle() != null || !(Math.abs(event.getTo().getPitch()) < 80.0F) || !(Math.abs(yaw) > 0.1)) {
|
||||
this.buffer.decrement(2);
|
||||
} else if (this.buffer.record(ticks)) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.MEDIUM, "dYaw: " + yaw));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleB1 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(20L, 10);
|
||||
private long lastUseEntityTick;
|
||||
private long lastArmAnimationTick;
|
||||
|
||||
public KillauraModuleB1(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
long now = System.currentTimeMillis() - this.lastUseEntityTick;
|
||||
if (PacketMathUtils.isAttackPacket(event.getPacket())) {
|
||||
if (now < 35L && this.lastArmAnimationTick + 4L < ticks && this.buffer.record(ticks)) {
|
||||
this.violationConsumer
|
||||
.accept(new CombatModuleViolation(ViolationTier.HIGH, "e: " + now + " l: " + this.buffer.getCount()));
|
||||
}
|
||||
} else if (PacketMathUtils.isMovementPacket(event.getPacketType())) {
|
||||
if (now < 5L) {
|
||||
this.lastArmAnimationTick = ticks;
|
||||
}
|
||||
|
||||
this.lastUseEntityTick = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.PacketType.Play.Client;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleB2 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(20L, 4);
|
||||
private int postSwingTicks;
|
||||
private int swingCount;
|
||||
|
||||
public KillauraModuleB2(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
if (PacketMathUtils.isAttackPacket(event.getPacket())) {
|
||||
this.swingCount++;
|
||||
} else if (event.getPacketType() == Client.ARM_ANIMATION) {
|
||||
this.postSwingTicks++;
|
||||
} else if (PacketMathUtils.isMovementPacket(event.getPacketType())) {
|
||||
if (this.swingCount > this.postSwingTicks && this.buffer.record(ticks)) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.HIGH, "a: " + this.swingCount + " s: " + this.postSwingTicks));
|
||||
}
|
||||
|
||||
this.swingCount = 0;
|
||||
this.postSwingTicks = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.PacketType.Play.Client;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerAction;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleB3 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(30L, 3);
|
||||
private long lastEntityActionTick;
|
||||
private boolean hadSprintAction;
|
||||
|
||||
public KillauraModuleB3(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
if (event.getPacketType() == Client.ENTITY_ACTION) {
|
||||
if (event.getPacket().getPlayerActions().read(0) == PlayerAction.START_SPRINTING) {
|
||||
if (this.hadSprintAction) {
|
||||
if (ticks <= this.lastEntityActionTick + 1L) {
|
||||
if (this.buffer.record(ticks)) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.HIGH, ""));
|
||||
}
|
||||
} else {
|
||||
this.hadSprintAction = false;
|
||||
}
|
||||
} else {
|
||||
this.hadSprintAction = true;
|
||||
this.lastEntityActionTick = ticks;
|
||||
}
|
||||
}
|
||||
} else if (PacketMathUtils.isMovementPacket(event.getPacketType())) {
|
||||
this.hadSprintAction = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleB4 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(200L, 4);
|
||||
private double[] doubleArrayValue = new double[20];
|
||||
private double[] doubleArrayValue2 = new double[20];
|
||||
private int hitStreak;
|
||||
private long lastAttackTick = 0L;
|
||||
|
||||
public KillauraModuleB4(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
float yaw = Math.abs(PacketMathUtils.wrapYawDelta(event.getFrom().getYaw(), event.getTo().getYaw()));
|
||||
float pitch = Math.abs(event.getTo().getPitch() - event.getFrom().getPitch());
|
||||
if (!(yaw > 25.0F)) {
|
||||
if (this.lastAttackTick + 10L >= ticks) {
|
||||
this.doubleArrayValue[this.hitStreak] = yaw;
|
||||
this.doubleArrayValue2[this.hitStreak] = pitch;
|
||||
this.hitStreak++;
|
||||
if (this.hitStreak >= 20) {
|
||||
this.hitStreak = 0;
|
||||
long ticks2 = this.doubleArrayValue.length - Arrays.stream(this.doubleArrayValue).distinct().count();
|
||||
long ticks3 = this.doubleArrayValue2.length - Arrays.stream(this.doubleArrayValue2).distinct().count();
|
||||
if (ticks2 != 0L || ticks3 != 0L) {
|
||||
this.buffer.reset();
|
||||
} else if (this.buffer.record(ticks)) {
|
||||
this.violationConsumer
|
||||
.accept(
|
||||
new CombatModuleViolation(
|
||||
this.buffer.getCount() > 6 ? ViolationTier.MEDIUM : ViolationTier.LOW, ""
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
this.lastAttackTick = ticks;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleB5 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(20L, 2);
|
||||
private final double[] yawDeltas = new double[5];
|
||||
private final double[] pitchDeltas = new double[5];
|
||||
private int sampleIndex;
|
||||
|
||||
public KillauraModuleB5(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
float yaw = Math.abs(PacketMathUtils.wrapYawDelta(event.getFrom().getYaw(), event.getTo().getYaw()));
|
||||
float pitch = Math.abs(event.getTo().getPitch() - event.getFrom().getPitch());
|
||||
this.yawDeltas[this.sampleIndex] = yaw;
|
||||
this.pitchDeltas[this.sampleIndex] = pitch;
|
||||
if (this.sampleIndex >= 5) {
|
||||
this.sampleIndex = 0;
|
||||
long ticks2 = Arrays.stream(this.yawDeltas).filter(v -> v > 10.0).count()
|
||||
+ Arrays.stream(this.pitchDeltas).filter(v -> v > 7.0).count();
|
||||
double d = Arrays.stream(this.yawDeltas).average().orElse(0.0);
|
||||
double d2 = Arrays.stream(this.pitchDeltas).average().orElse(0.0);
|
||||
if (d2 >= 0.0 && d >= 5.6 && ticks2 >= 3L && ticks2 < 6L) {
|
||||
if (this.buffer.record(ticks)) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.HIGH, d2 + " / " + d));
|
||||
} else {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.LOW, d2 + " / " + d));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.movement.EntityDimensions;
|
||||
import me.konsolas.aac.util.BoundingBox;
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.PacketType.Play.Client;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class KillauraModuleB6 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(12L, 20);
|
||||
private long lastAttackTick;
|
||||
private long lastFlyingTick;
|
||||
private Entity entityValue;
|
||||
|
||||
public KillauraModuleB6(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
if (PacketMathUtils.isAttackPacket(event.getPacket())) {
|
||||
this.lastFlyingTick = 0L;
|
||||
this.lastAttackTick = ticks;
|
||||
} else if (event.getPacketType() == Client.ARM_ANIMATION && this.isCombatCheckReady()) {
|
||||
if (this.lastAttackTick == ticks) {
|
||||
this.lastAttackTick = 0L;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.entityValue != null) {
|
||||
Vector vector = this.entityValue.getLocation().toVector();
|
||||
Entity entity = this.entityValue;
|
||||
double d = new BoundingBox(vector, EntityDimensions.forEntity(entity))
|
||||
.expand(-0.05, -0.15, -0.05)
|
||||
.rayTraceDistance(event.getPlayer().getEyeLocation().toVector(), event.getPlayer().getLocation().getDirection());
|
||||
if (!Double.isNaN(d) && d > 1.0 && d < 3.0) {
|
||||
this.lastFlyingTick = ticks;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
if (this.lastFlyingTick != 0L && this.buffer.record(ticks)) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.MEDIUM, ""));
|
||||
this.lastFlyingTick = 0L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
this.entityValue = event.getEntity();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleB7 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(15L, 12);
|
||||
private float lastYaw;
|
||||
private float lastPitch;
|
||||
|
||||
public KillauraModuleB7(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
float pitch = event.getTo().getPitch() - event.getFrom().getPitch();
|
||||
float f = this.lastYaw;
|
||||
this.lastYaw = pitch;
|
||||
float yaw = PacketMathUtils.wrapYawDelta(event.getFrom().getYaw(), event.getTo().getYaw());
|
||||
float f2 = this.lastPitch;
|
||||
this.lastPitch = yaw;
|
||||
if (Math.abs(pitch) > 10.0 && Math.abs(f) > 10.0 && Math.abs(pitch + f) < 1.0 && this.buffer.record(ticks)) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.HIGH, "p: " + pitch + " s: " + (pitch + f)));
|
||||
}
|
||||
|
||||
if (Math.abs(yaw) > 10.0 && Math.abs(f2) > 10.0 && Math.abs(yaw + f2) < 1.0 && this.buffer.record(ticks)) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.HIGH, "y: " + yaw + " s: " + (yaw + f2)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.RollingDoubleWindow;
|
||||
import com.comphenix.protocol.PacketType.Play.Client;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleC1 extends CombatCheckModule {
|
||||
private final RollingDoubleWindow rollingDoubleWindowValue = new RollingDoubleWindow(5);
|
||||
private int packetCount;
|
||||
private int flagCount;
|
||||
private double lastYawDiff;
|
||||
|
||||
public KillauraModuleC1(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
if (event.getPacketType() == Client.ARM_ANIMATION && this.isCombatCheckReady()) {
|
||||
this.packetCount++;
|
||||
} else if (PacketMathUtils.isMovementPacket(event.getPacketType()) && ++this.flagCount == 20 && this.packetCount > 0) {
|
||||
this.rollingDoubleWindowValue.addSample(this.packetCount);
|
||||
double d = this.rollingDoubleWindowValue.stream().average().orElse(0.0);
|
||||
if (d >= 9.0) {
|
||||
if (Math.round(d) != d && Math.round(d) != d - 0.5) {
|
||||
this.lastYawDiff = Math.max(0.0, this.lastYawDiff - 4.0);
|
||||
} else if ((this.lastYawDiff += 4.0) > 40.0) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.MEDIUM, "a: " + d));
|
||||
}
|
||||
} else {
|
||||
this.lastYawDiff = Math.max(0.0, this.lastYawDiff - 1.0);
|
||||
}
|
||||
|
||||
if (this.rollingDoubleWindowValue.isFilled()) {
|
||||
this.rollingDoubleWindowValue.reset();
|
||||
}
|
||||
|
||||
this.packetCount = 0;
|
||||
this.flagCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.PacketMathUtils;
|
||||
import me.konsolas.aac.util.RollingDoubleWindow;
|
||||
import com.comphenix.protocol.PacketType.Play.Client;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.DoubleSummaryStatistics;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleC2 extends CombatCheckModule {
|
||||
private int consistentCount;
|
||||
private int inconsistentCount;
|
||||
private int sampleCount;
|
||||
private RollingDoubleWindow rollingDoubleWindowValue = new RollingDoubleWindow(5);
|
||||
|
||||
public KillauraModuleC2(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
if (event.getPacketType() == Client.ARM_ANIMATION && this.isCombatCheckReady()) {
|
||||
this.consistentCount++;
|
||||
} else if (PacketMathUtils.isMovementPacket(event.getPacketType()) && ++this.inconsistentCount == 20) {
|
||||
if (this.consistentCount > 0) {
|
||||
this.rollingDoubleWindowValue.addSample(this.consistentCount);
|
||||
DoubleSummaryStatistics doubleSummaryStatistics = this.rollingDoubleWindowValue.stream().summaryStatistics();
|
||||
if (!(doubleSummaryStatistics.getAverage() >= 8.0) || !(doubleSummaryStatistics.getAverage() < 17.0) || doubleSummaryStatistics.getMax() != doubleSummaryStatistics.getMin()) {
|
||||
this.sampleCount = Math.max(this.sampleCount - 1, 0);
|
||||
} else if ((this.sampleCount += 2) > 12) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.MEDIUM, "v: " + this.sampleCount + " a: " + doubleSummaryStatistics.getAverage()));
|
||||
} else if (this.sampleCount > 7) {
|
||||
this.violationConsumer.accept(new CombatModuleViolation(ViolationTier.LOW, "v: " + this.sampleCount + " a: " + doubleSummaryStatistics.getAverage()));
|
||||
}
|
||||
}
|
||||
|
||||
this.inconsistentCount = 0;
|
||||
this.consistentCount = 0;
|
||||
if (this.rollingDoubleWindowValue.isFilled()) {
|
||||
this.rollingDoubleWindowValue.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.PacketType.Play.Client;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleC3 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(100L, 25);
|
||||
private long lastBlockPlaceTick;
|
||||
|
||||
public KillauraModuleC3(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
if (event.getPacketType() == Client.ARM_ANIMATION && this.isCombatCheckReady()) {
|
||||
long now = System.currentTimeMillis();
|
||||
long ticks2 = now - this.lastBlockPlaceTick;
|
||||
if (ticks2 > 0L && ticks2 < 200L) {
|
||||
double d = 1000.0 / ticks2;
|
||||
if (d % 0.5 != 0.0 && d % 1.0 != 0.0) {
|
||||
this.buffer.decrement(1);
|
||||
} else if (this.buffer.record(ticks, 2)) {
|
||||
this.violationConsumer
|
||||
.accept(new CombatModuleViolation(ViolationTier.MEDIUM, "v: " + this.buffer.getCount() + " c: " + d));
|
||||
}
|
||||
}
|
||||
|
||||
this.lastBlockPlaceTick = now;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.PacketType.Play.Client;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleC4 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer = new TimedThresholdBuffer(100L, 7);
|
||||
private long lastInteractTick;
|
||||
private final long[] longArrayValue = new long[50];
|
||||
private int suspiciousCount;
|
||||
|
||||
public KillauraModuleC4(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
if (event.getPacketType() == Client.ARM_ANIMATION && this.isCombatCheckReady()) {
|
||||
long now = System.currentTimeMillis();
|
||||
long ticks2 = now - this.lastInteractTick;
|
||||
if (ticks2 < 160L) {
|
||||
this.longArrayValue[this.suspiciousCount++] = ticks2;
|
||||
}
|
||||
|
||||
if (this.suspiciousCount >= this.longArrayValue.length) {
|
||||
double d = Arrays.stream(this.longArrayValue).average().orElse(0.0);
|
||||
double d2 = Math.abs(ticks2 - d);
|
||||
if (d2 < 10.0) {
|
||||
if (this.buffer.record(ticks)) {
|
||||
this.violationConsumer
|
||||
.accept(
|
||||
new CombatModuleViolation(
|
||||
this.buffer.getCount() > 30 ? ViolationTier.HIGH : ViolationTier.MEDIUM,
|
||||
"a: " + d + " d: " + d2
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
this.buffer.reset();
|
||||
}
|
||||
|
||||
Arrays.fill(this.longArrayValue, 0L);
|
||||
this.suspiciousCount = 0;
|
||||
}
|
||||
|
||||
this.lastInteractTick = now;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import com.comphenix.protocol.PacketType.Play.Client;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.LongSummaryStatistics;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class KillauraModuleC5 extends CombatCheckModule {
|
||||
private final TimedThresholdBuffer buffer;
|
||||
private long lastTick;
|
||||
private long tickDiff;
|
||||
private long[] longArrayValue;
|
||||
private int streak;
|
||||
|
||||
public KillauraModuleC5(Consumer consumer, KillauraPlayerData data) {
|
||||
super(consumer, data);
|
||||
this.buffer = new TimedThresholdBuffer(100L, 15);
|
||||
this.longArrayValue = new long[20];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacket(PacketEvent event, long ticks) {
|
||||
if (event.getPacketType() == Client.ARM_ANIMATION && this.isCombatCheckReady()) {
|
||||
long now = System.currentTimeMillis();
|
||||
long ticks2 = now - this.lastTick;
|
||||
if (ticks2 > 2L && this.streak < 20 && ticks2 < 1000L) {
|
||||
this.longArrayValue[this.streak++] = ticks2;
|
||||
} else if (this.streak >= 20) {
|
||||
LongSummaryStatistics longSummaryStatistics = Arrays.stream(this.longArrayValue).summaryStatistics();
|
||||
long ticks3 = longSummaryStatistics.getMax() - longSummaryStatistics.getMin();
|
||||
if (longSummaryStatistics.getAverage() > 110.0 && (ticks3 < 65L || Math.abs(ticks3 - this.tickDiff) < 3L)) {
|
||||
if (this.buffer.record(ticks)) {
|
||||
this.violationConsumer
|
||||
.accept(
|
||||
new CombatModuleViolation(
|
||||
this.buffer.getCount() >= 25 ? ViolationTier.HIGH : ViolationTier.MEDIUM,
|
||||
"r: " + ticks3 + " lr: " + this.tickDiff + " a: " + longSummaryStatistics.getAverage()
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
this.buffer.decrement(1);
|
||||
}
|
||||
|
||||
this.tickDiff = ticks3;
|
||||
this.streak = 0;
|
||||
}
|
||||
|
||||
this.lastTick = now;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event, long ticks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event, long ticks) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.CheckPlayerData;
|
||||
import me.konsolas.aac.util.TimedThresholdBuffer;
|
||||
import java.util.Set;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
public class KillauraPlayerData extends CheckPlayerData {
|
||||
private Set<CombatCheckModule> modules;
|
||||
private long lastAttackTick = 0L;
|
||||
private TimedThresholdBuffer moveBuffer = new TimedThresholdBuffer(20L, 10);
|
||||
public BooleanSupplier combatReadySupplier;
|
||||
|
||||
public static Set<CombatCheckModule> getModules(KillauraPlayerData data) {
|
||||
return data.modules;
|
||||
}
|
||||
|
||||
public static Set<CombatCheckModule> setModules(KillauraPlayerData data, Set<CombatCheckModule> set) {
|
||||
return data.modules = set;
|
||||
}
|
||||
|
||||
public static long setLastAttackTick(KillauraPlayerData data, long ticks) {
|
||||
return data.lastAttackTick = ticks;
|
||||
}
|
||||
|
||||
public static long getLastAttackTick(KillauraPlayerData data) {
|
||||
return data.lastAttackTick;
|
||||
}
|
||||
|
||||
public static TimedThresholdBuffer getMoveBuffer(KillauraPlayerData data) {
|
||||
return data.moveBuffer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.Check;
|
||||
import me.konsolas.aac.checks.CheckManager;
|
||||
import me.konsolas.aac.checks.PlayerData;
|
||||
import me.konsolas.aac.compat.ProtocolVersion;
|
||||
import java.util.Collections;
|
||||
import me.konsolas.aac.api.HackType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
|
||||
public class Regen extends Check {
|
||||
public Regen(CheckManager checkManager) {
|
||||
super(checkManager, HackType.REGEN, RegenPlayerData::new, Collections.emptyList(), true, (player, data) -> true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityRegainHealth(Player player, PlayerData playerData, EntityRegainHealthEvent event) {
|
||||
Killaura.unusedFlag();
|
||||
RegenPlayerData data = (RegenPlayerData)playerData.getCheckData(HackType.REGEN);
|
||||
if (event.getRegainReason() == RegainReason.SATIATED) {
|
||||
long now = System.currentTimeMillis() - data.lastHealMillis;
|
||||
if (!ProtocolVersion.getServerVersion().isAtLeast(ProtocolVersion.V1_9)) {
|
||||
String str = "min_regen_delay";
|
||||
if (now < this.getLongOption(str)) {
|
||||
String str2 = "regenerated health too quickly (" + now + " ms)";
|
||||
byte b = 1;
|
||||
Player player2 = player;
|
||||
if (this.addViolation(player2, b, str2)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String str3 = "min_satiated_delay";
|
||||
if (now < this.getLongOption(str3)) {
|
||||
String str4 = "regenerated health too quickly (" + now + "ms)";
|
||||
byte b2 = 1;
|
||||
Player player3 = player;
|
||||
if (this.addViolation(player3, b2, str4)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (player.getFoodLevel() < 20) {
|
||||
String str5 = "min_regen_delay";
|
||||
if (now < this.getLongOption(str5)) {
|
||||
String str6 = "regenerated health too quickly (" + now + "ms)";
|
||||
byte b3 = 1;
|
||||
Player player4 = player;
|
||||
if (this.addViolation(player4, b3, str6)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
|
||||
import me.konsolas.aac.checks.CheckPlayerData;
|
||||
public class RegenPlayerData extends CheckPlayerData {
|
||||
public long lastHealMillis;
|
||||
|
||||
public RegenPlayerData() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package me.konsolas.aac.checks.combat;
|
||||
|
||||
public enum ViolationTier {
|
||||
LOW,
|
||||
MEDIUM,
|
||||
HIGH;
|
||||
}
|
||||
Reference in new issue
Block a user