Skip to content

Commit

Permalink
Release 2.10.1
Browse files Browse the repository at this point in the history
- 新检查 BoatFlyA
- 新检查 FlyC
- 改进AntiBot模块
    - 添加InTabList选项
  • Loading branch information
xia-mc committed May 28, 2024
1 parent 833e962 commit fccb6ea
Show file tree
Hide file tree
Showing 28 changed files with 193 additions and 30 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ minecraft_version=1.20.1
loader_version=0.14.23

# Mod Properties
mod_version = 2.10.0
mod_version = 2.10.1
maven_group = top.infsky
archives_base_name = CheatDetector

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,11 @@ public class Advanced3Config {
public static boolean writerToBook = false;

@Config(category = ConfigCategory.ADVANCED3)
public static boolean antiBotMessage = true;
public static boolean antiBotMessage = false;
@Config(category = ConfigCategory.ADVANCED3)
public static boolean antiBotLatency = true;
public static boolean antiBotLatency = false;
@Config(category = ConfigCategory.ADVANCED3)
public static boolean antiBotInTabList = false;
@Config(category = ConfigCategory.ADVANCED3)
public static boolean antiBotDebug = false;
@Config(category = ConfigCategory.ADVANCED3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public class AdvancedConfig {
@Config(category = ConfigCategory.ADVANCED)
public static boolean flyACheck = true;
@Config(category = ConfigCategory.ADVANCED)
public static int flyAAlertBuffer = 10;
public static int flyAAlertBuffer = 30;

@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static boolean autoClickerACheck = true;
Expand All @@ -142,6 +142,20 @@ public class AdvancedConfig {
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static int autoClickerAMinDiffMs = 5;

@Config(category = ConfigCategory.ADVANCED)
public static boolean flyCCheck = true;
@Config(category = ConfigCategory.ADVANCED)
public static int flyCAlertBuffer = 30;
@Config(category = ConfigCategory.ADVANCED)
public static double flyCMinDiffYMotion = 0.1;
@Config(category = ConfigCategory.ADVANCED)
public static int flyCMinRepeatTicks = 5;

@Config(category = ConfigCategory.ADVANCED)
public static boolean boatFlyACheck = true;
@Config(category = ConfigCategory.ADVANCED)
public static int boatFlyAAlertBuffer = 20;

public static short getNoSlowAInJumpDisableTick() {
return (short) noSlowAInJumpDisableTick;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.combat;

import io.netty.channel.ChannelHandlerContext;
import net.minecraft.network.Connection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.combat;

import io.netty.channel.ChannelHandlerContext;
import net.minecraft.network.Connection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.combat;

import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.world.entity.LivingEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.combat;

import net.minecraft.world.entity.LivingEntity;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.combat;

import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.exploits;

import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.impl.Check;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.movement;

import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.impl.Check;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package top.infsky.cheatdetector.impl.checks.movement;

import net.minecraft.world.entity.vehicle.Boat;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BubbleColumnBlock;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.config.AdvancedConfig;
import top.infsky.cheatdetector.impl.Check;
import top.infsky.cheatdetector.utils.TRPlayer;

import java.util.List;
import java.util.function.Predicate;


public class BoatFlyA extends Check {
public static final List<Block> IGNORE_BLOCKS = List.of(Blocks.WATER, Blocks.PISTON, Blocks.PISTON_HEAD, Blocks.MOVING_PISTON, Blocks.STICKY_PISTON);
public BoatFlyA(@NotNull TRPlayer player) {
super("BoatFlyA", player);
}

@Override
public void _onTick() {
if (player.fabricPlayer.getVehicle() instanceof Boat boat) {
if (boat.onGround()) return;
if (boat.isInWater()) {
if (blockCheck(boat, blockState -> blockState.is(Blocks.BUBBLE_COLUMN) && !blockState.getValue(BubbleColumnBlock.DRAG_DOWN)))
return;
} else {
if (IGNORE_BLOCKS.stream().anyMatch(block -> blockCheck(boat, blockState -> blockState.is(block))))
return;
}

if (player.currentVehicleMotion.y() >= 0) {
flag("Invalid boat Y-motion: %s inWater=%s onGround=%s".formatted(player.currentVehicleMotion.y(), boat.isInWater(), boat.onGround()));
}
}
}

private static boolean blockCheck(@NotNull Boat boat, @NotNull Predicate<BlockState> predicate) {
return predicate.test(boat.getFeetBlockState()) || predicate.test(boat.getBlockStateOn());
}

@Override
public int getAlertBuffer() {
return AdvancedConfig.boatFlyAAlertBuffer;
}

@Override
public boolean isDisabled() {
return !AdvancedConfig.boatFlyACheck;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.movement;

import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.config.AdvancedConfig;
import top.infsky.cheatdetector.impl.Check;
import top.infsky.cheatdetector.impl.utils.world.PlayerMove;
import top.infsky.cheatdetector.utils.TRPlayer;

public class FlyA extends Check {
Expand All @@ -12,8 +13,10 @@ public FlyA(@NotNull TRPlayer player) {

@Override
public void _onTick() {
if (player.fabricPlayer.isPassenger() || !PlayerMove.isMove(player.currentMotion)) return;

if (player.lastMotion.y() == 0 && player.currentMotion.y() == 0) {
flag("Invalid Y-axis motion.");
flag("Invalid Y-motion. onGround=%s".formatted(player.currentOnGround));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.movement;

import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.config.AdvancedConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package top.infsky.cheatdetector.impl.checks.movement;

import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.config.AdvancedConfig;
import top.infsky.cheatdetector.impl.Check;
import top.infsky.cheatdetector.utils.TRPlayer;

import java.util.List;

public class FlyC extends Check {
public static final List<Block> IGNORED_BLOCKS = List.of(Blocks.COBWEB, Blocks.WATER, Blocks.LAVA, Blocks.POWDER_SNOW);
public FlyC(@NotNull TRPlayer player) {
super("FlyC", player);
}

@Override
public void _onTick() {
if (player.fabricPlayer.isPassenger()
|| player.currentOnGround || player.fabricPlayer.isFallFlying()
|| IGNORED_BLOCKS.stream().anyMatch(block -> player.fabricPlayer.getFeetBlockState().is(block))) return;

int repeatFromTick = 0;
for (int i = 0; i < player.motionHistory.size(); i++) {
if (Math.abs(player.motionHistory.get(i).y() - player.currentMotion.y()) >= AdvancedConfig.flyCMinDiffYMotion) {
return;
}

repeatFromTick++;
}

if (repeatFromTick >= AdvancedConfig.flyCMinRepeatTicks) {
flag("Repeat Y-motion from %s ticks.".formatted(repeatFromTick));
}
}

@Override
public int getAlertBuffer() {
return AdvancedConfig.flyCAlertBuffer;
}

@Override
public boolean isDisabled() {
return !AdvancedConfig.flyCCheck;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.movement;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.movement;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.movement;

import lombok.val;
import net.minecraft.world.phys.Vec3;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.movement;

import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.movement;

import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.movement;

import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.impl.Check;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.movement;

import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.impl.Check;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.checks;
package top.infsky.cheatdetector.impl.checks.movement;

import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.infsky.cheatdetector.impl.modules.pas;
package top.infsky.cheatdetector.impl.modules.common;

import io.netty.channel.ChannelHandlerContext;
import lombok.Getter;
Expand All @@ -15,6 +15,7 @@
import top.infsky.cheatdetector.config.Advanced3Config;
import top.infsky.cheatdetector.config.ModuleConfig;
import top.infsky.cheatdetector.impl.Module;
import top.infsky.cheatdetector.impl.utils.world.LevelUtils;
import top.infsky.cheatdetector.utils.TRSelf;

import java.util.*;
Expand Down Expand Up @@ -44,9 +45,28 @@ public void _onTick() {
botList.clear();
}

if (!Advanced3Config.antiBotLatency)
disableCheck = false;

if (disableCheck) {
CheatDetector.manager.getDataMap().values().forEach(trPlayer -> trPlayer.manager.disableTick = 10);
}

try {
if (Advanced3Config.antiBotInTabList) {
List<PlayerInfo> players = new LinkedList<>(player.fabricPlayer.connection.getOnlinePlayers());
LevelUtils.getClientLevel().players().forEach(p -> {
try {
PlayerInfo playerInfo = Objects.requireNonNull(player.fabricPlayer.connection.getPlayerInfo(p.getUUID()));
players.remove(playerInfo);
removeBotVisual(playerInfo);
} catch (NullPointerException ignored) {
}
});

players.forEach(this::addBotVisual);
}
} catch (Exception ignored) {}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public static boolean isMove() {
|| TRPlayer.CLIENT.options.keyRight.isDown();
}

public static boolean isMove(@NotNull Vec3 motion) {
return motion.x() != 0 || motion.z() != 0;
}

/**
* Gets the players predicted jump motion the specified amount of ticks ahead
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.CheatDetector;
import top.infsky.cheatdetector.impl.Check;
import top.infsky.cheatdetector.impl.checks.*;
import top.infsky.cheatdetector.impl.checks.combat.*;
import top.infsky.cheatdetector.impl.checks.exploits.GameModeA;
import top.infsky.cheatdetector.impl.checks.movement.*;
import top.infsky.cheatdetector.impl.fixes.ServerFreeze;
import top.infsky.cheatdetector.impl.fixes.grimac.InvalidYaw;
import top.infsky.cheatdetector.impl.modules.*;
Expand Down Expand Up @@ -65,6 +67,9 @@ public CheckManager(@NotNull Map<Class<? extends Check>, Check> preChecks,
normal.put(MotionA.class, new MotionA(player));
normal.put(ReachA.class, new ReachA(player));
normal.put(HitBoxA.class, new HitBoxA(player));
normal.put(AutoClickerA.class, new AutoClickerA(player));
normal.put(FlyC.class, new FlyC(player));
normal.put(BoatFlyA.class, new BoatFlyA(player));

return new CheckManager(pre, normal, post, player);
}
Expand All @@ -90,6 +95,8 @@ public CheckManager(@NotNull Map<Class<? extends Check>, Check> preChecks,
normal.put(ReachA.class, new ReachA(player));
normal.put(HitBoxA.class, new HitBoxA(player));
normal.put(AutoClickerA.class, new AutoClickerA(player));
normal.put(FlyC.class, new FlyC(player));
normal.put(BoatFlyA.class, new BoatFlyA(player));

pre.put(BadPacket1.class, new BadPacket1(player));
pre.put(BadPacket2.class, new BadPacket2(player));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.AbstractClientPlayer;
import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.impl.modules.pas.AntiBot;
import top.infsky.cheatdetector.impl.modules.common.AntiBot;
import top.infsky.cheatdetector.impl.utils.world.LevelUtils;

import java.util.*;
Expand Down
Loading

0 comments on commit fccb6ea

Please sign in to comment.