Skip to content

Commit

Permalink
Fixed false positives
Browse files Browse the repository at this point in the history
- Fixed false positives in Fly (A).
- Fixed false positives in Speed (A).
- Fixed false positives related to jumping on stairs.
  • Loading branch information
funkemunky committed Sep 8, 2020
1 parent edae432 commit bb4fa8f
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import dev.brighten.api.check.CheckType;
import lombok.val;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand All @@ -24,9 +26,17 @@ public class ReachA extends Check {
private LivingEntity target;
private double buffer;

private static List<EntityType> allowedEntityTypes = Arrays
.asList(EntityType.ZOMBIE, EntityType.SHEEP, EntityType.BLAZE,
EntityType.SKELETON, EntityType.PLAYER, EntityType.VILLAGER, EntityType.IRON_GOLEM,
EntityType.WITCH, EntityType.COW, EntityType.CREEPER);

@Packet
public void onFlying(WrappedInUseEntityPacket packet, long timeStamp) {
if(data.playerInfo.creative || data.targetPastLocation.previousLocations.size() < 10) return;
if(data.playerInfo.creative
|| data.targetPastLocation.previousLocations.size() < 10
|| target == null
|| !allowedEntityTypes.contains(target.getType())) return;

List<SimpleCollisionBox> targetBoxes = data.targetPastLocation
.getEstimatedLocation(timeStamp, (data.lagInfo.transPing + 3) * 50, 100L)
Expand Down Expand Up @@ -64,7 +74,6 @@ public void onUse(WrappedInUseEntityPacket packet, long timeStamp) {
}

private static SimpleCollisionBox getHitbox(Entity entity, KLocation loc) {
CollisionBox box = EntityData.getEntityBox(loc, entity);
return box instanceof SimpleCollisionBox ? (SimpleCollisionBox) box : null;
return (SimpleCollisionBox) EntityData.getEntityBox(loc, entity);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraft.server.v1_8_R3.BlockClay;

@CheckInfo(name = "Fly (A)", description = "Simple fly check.", punishVL = 10,
checkType = CheckType.FLIGHT, vlToFlag = 1, developer = true)
checkType = CheckType.FLIGHT, vlToFlag = 3, developer = true)
@Cancellable
public class FlyA extends Check {

Expand Down Expand Up @@ -75,6 +75,7 @@ public void onFlying(WrappedInFlyingPacket packet, long timeStamp) {
if(check > 0.016 && data.playerInfo.lastHalfBlock.hasPassed(5)
&& data.playerInfo.lastVelocity.hasPassed(4)) {
vl++;
if(vl > 2)
flag("deltaY=%v.4 predicted=%v.4", data.playerInfo.deltaY, predicted);
} else if(vl > 0) vl-= 0.1;
end = System.nanoTime() - start;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ public class SpeedA extends Check {
private double ldxz = .12f;
private float friction = 0.91f;
private float buffer;
private double vxz;

@Packet
public void onVelocity(WrappedOutVelocityPacket packet) {
if(packet.getId() == data.getPlayer().getEntityId()) {
data.runKeepaliveAction(ka -> {
ldxz = Math.hypot(packet.getX(), packet.getZ());
debug("set velocity: %v.3", ldxz);
vxz = Math.hypot(packet.getX(), packet.getZ());
debug("set velocity: %v.3", vxz);
});
}
}
Expand Down Expand Up @@ -86,7 +87,10 @@ public void onFlying(WrappedInFlyingPacket packet) {
} else if(buffer > 0) buffer-= 0.2f;
debug("ratio=%v.1 tags=%v", ratio, tags.build());

ldxz = data.playerInfo.deltaXZ * drag;
if(vxz != 0) {
ldxz = vxz;
vxz = 0;
} else ldxz = data.playerInfo.deltaXZ * drag;
}
friction = data.blockInfo.currentFriction;
}
Expand Down
3 changes: 1 addition & 2 deletions Impl/src/main/java/dev/brighten/anticheat/Load.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
import dev.brighten.anticheat.processing.keepalive.KeepaliveProcessor;
import dev.brighten.anticheat.utils.SystemUtil;
import dev.brighten.anticheat.utils.TickTimer;
import dev.brighten.anticheat.utils.file.FileDownloader;
import dev.brighten.anticheat.classloader.file.FileDownloader;
import dev.brighten.api.KauriAPI;
import org.bukkit.Bukkit;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package dev.brighten.anticheat.classloader;

import dev.brighten.anticheat.utils.SystemUtil;
import dev.brighten.anticheat.utils.file.JarUtil;
import lombok.Getter;
import dev.brighten.anticheat.classloader.file.JarUtil;

import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.brighten.anticheat.utils.file;
package dev.brighten.anticheat.classloader.file;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.brighten.anticheat.utils.file;
package dev.brighten.anticheat.classloader.file;

import java.io.*;
import java.util.Enumeration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,7 @@ public void process(WrappedInFlyingPacket packet, long timeStamp) {
//Running jump check
if (!data.playerInfo.clientGround) {
if (!data.playerInfo.jumped && data.playerInfo.lClientGround
&& data.playerInfo.deltaY >= 0
&& data.playerInfo.deltaY <= data.playerInfo.jumpHeight) {
&& data.playerInfo.deltaY >= 0) {
data.playerInfo.jumped = true;
} else {
data.playerInfo.inAir = true;
Expand Down
2 changes: 1 addition & 1 deletion Premium/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<groupId>dev.brighten.anticheat</groupId>
<artifactId>Impl</artifactId>
<version>${parent.version}</version>
<scope>compile</scope>
<scope>provided</scope>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void registerChecks() {
Check.register(new KillauraD());
Check.register(new KillauraE());
//Check.register(new KillauraF());
Check.register(new OmniSprint());
//Check.register(new OmniSprint());
Check.register(new Timer());
Check.register(new VelocityA());
Check.register(new VelocityC());
Expand Down

0 comments on commit bb4fa8f

Please sign in to comment.