-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Nova-Committee/master
Sync update
- Loading branch information
Showing
19 changed files
with
188 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/top/infsky/cheatdetector/commands/DebugCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package top.infsky.cheatdetector.commands; | ||
|
||
import com.mojang.brigadier.context.CommandContext; | ||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; | ||
import net.minecraft.network.chat.Component; | ||
import org.jetbrains.annotations.NotNull; | ||
import top.infsky.cheatdetector.CheatDetector; | ||
import top.infsky.cheatdetector.impl.utils.ListUtils; | ||
|
||
import java.util.NoSuchElementException; | ||
|
||
public class DebugCommand { | ||
public static int execute(@NotNull CommandContext<FabricClientCommandSource> context) { | ||
String name = context.getArgument("name", String.class); | ||
|
||
try { | ||
context.getSource().sendFeedback(Component.literal(ListUtils.getSpilt( | ||
CheatDetector.manager.getDataMap().values() | ||
.stream() | ||
.filter(trPlayer -> trPlayer.fabricPlayer.getName().getString().endsWith(name)) | ||
.findAny() | ||
.orElseThrow() | ||
.motionHistory))); | ||
return 1; | ||
} catch (NoSuchElementException e) { | ||
return 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/top/infsky/cheatdetector/impl/checks/movement/StrafeA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package top.infsky.cheatdetector.impl.checks.movement; | ||
|
||
import net.minecraft.world.phys.Vec3; | ||
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 StrafeA extends Check { | ||
private Vec3 futureMotion = null; | ||
|
||
public StrafeA(@NotNull TRPlayer player) { | ||
super("StrafeA", player); | ||
} | ||
|
||
@Override | ||
public void _onTick() { | ||
if (player.currentOnGround || PlayerMove.isNoMove(player.currentMotion) || player.lastRot.equals(player.currentRot)) { | ||
futureMotion = null; | ||
return; | ||
} | ||
|
||
if (PlayerMove.isInvalidMotion(player.currentMotion)) return; | ||
|
||
if (futureMotion != null) { | ||
double diff = PlayerMove.getMaxXZDiff(player.currentMotion, futureMotion); | ||
if (diff <= AdvancedConfig.strafeAMaxDiffToFlag) { | ||
flag("Strafe in air. diff:%.4f".formatted(diff)); | ||
} | ||
} | ||
|
||
futureMotion = PlayerMove.getStrafeMotion( | ||
PlayerMove.speed(player.fabricPlayer), | ||
PlayerMove.direction(1, 0, player.fabricPlayer.yRotO + (player.fabricPlayer.getYRot() - player.fabricPlayer.yRotO) * 50), | ||
player.currentMotion.y() | ||
); | ||
} | ||
|
||
|
||
|
||
@Override | ||
public int getAlertBuffer() { | ||
return AdvancedConfig.strafeAAlertBuffer; | ||
} | ||
|
||
@Override | ||
public boolean isDisabled() { | ||
return !AdvancedConfig.strafeACheck; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.