-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add BadPackets3 #1530
base: 2.0
Are you sure you want to change the base?
Add BadPackets3 #1530
Conversation
src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPackets3.java
Outdated
Show resolved
Hide resolved
avoid breaking how things are atm. /*
import them non static;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;
*/
@Override
public void onPacketReceive(PacketReceiveEvent event) {
if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && !player.packetStateData.lastPacketWasTeleport) {
sprints = 0;
sneaks = 0;
return;
}
if (event.getPacketType() == PacketType.Play.Client.ENTITY_ACTION) {
switch (new WrapperPlayClientEntityAction(event).getAction()) {
case START_SNEAKING:
case STOP_SNEAKING:
sneaks++;
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && sneaks > 1) {
if (flagAndAlert("sneak") && shouldModifyPackets()) {
event.setCancelled(true);
player.onPacketCancel();
}
}
break;
case START_SPRINTING:
case STOP_SPRINTING:
sprints++;
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && sprints > 1) {
if (flagAndAlert("sprint") && shouldModifyPackets()) {
event.setCancelled(true);
player.onPacketCancel();
}
}
break;
}
}
} |
Wouldn't this check be better off under velocity as SuperKnockbackHandler? // detects: LiquidBounce SuperKnockback (PACKET)
@CheckData(name = "SuperKnockback", alternativeName = "AntiKnockbackB", configName = "KnockbackB")
public class SuperKnockbackHandler extends Check implements PacketCheck, PostPredictionCheck {
public SuperKnockbackHandler(GrimPlayer player) {
super(player);
}
private float sprints = 0,
sneaks = 0;
@Override
public void onPredictionComplete(final PredictionComplete predictionComplete) {
// we don't need to check pre-1.9 players here (no tick skipping)
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9)) return;
if (player.skippedTickInActualMovement) {
sprints *= 0.05f;
sneaks *= 0.05f;
}
for (; sneaks > 1; sneaks--) flagAndAlert("sneak");
for (; sprints > 1; sprints--) flagAndAlert("sprint");
sneaks = 0;
sprints = 0;
}
@Override
public void onPacketReceive(PacketReceiveEvent event) {
if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && !player.packetStateData.lastPacketWasTeleport) {
sprints = 0;
sneaks = 0;
return;
}
if (event.getPacketType() == PacketType.Play.Client.ENTITY_ACTION) {
switch (new WrapperPlayClientEntityAction(event).getAction()) {
case START_SNEAKING:
case STOP_SNEAKING:
sneaks++;
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && sneaks > 1) {
if (flagAndAlert("sneak") && shouldModifyPackets()) {
event.setCancelled(true);
player.onPacketCancel();
}
}
break;
case START_SPRINTING:
case STOP_SPRINTING:
sprints++;
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && sprints > 1) {
if (flagAndAlert("sprint") && shouldModifyPackets()) {
event.setCancelled(true);
player.onPacketCancel();
}
}
break;
}
}
}
} |
Sounds very specific... BadPackets is good imo |
Idk about that, I feel like it's wrong to have it under BadPackets when the
thing it's detecting is super knock back, but alright, anyways; LGTM.
…On Sat, Jul 6, 2024, 5:31 PM MachineBreaker ***@***.***> wrote:
Wouldn't this check be better off under velocity as SuperKnockbackHandler?
You could even rename it to SuperKnockbackAHandler or better than any of
what I suggested would be making a folder alone, I don't see a reason this
is to be under BadPackets to be honest as it would also mess things up ngl
// detects: LiquidBounce SuperKnockback ***@***.***(name = "SuperKnockback", alternativeName = "AntiKnockbackB", configName = "KnockbackB")public class SuperKnockbackHandler extends Check implements PacketCheck, PostPredictionCheck {
public SuperKnockbackHandler(GrimPlayer player) {
super(player);
}
private float sprints = 0,
sneaks = 0;
@OverRide
public void onPredictionComplete(final PredictionComplete predictionComplete) {
// we don't need to check pre-1.9 players here (no tick skipping)
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9)) return;
if (player.skippedTickInActualMovement) {
sprints *= 0.05f;
sneaks *= 0.05f;
}
for (; sneaks > 1; sneaks--) flagAndAlert("sneak");
for (; sprints > 1; sprints--) flagAndAlert("sprint");
sneaks = 0;
sprints = 0;
}
@OverRide
public void onPacketReceive(PacketReceiveEvent event) {
if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && !player.packetStateData.lastPacketWasTeleport) {
sprints = 0;
sneaks = 0;
return;
}
if (event.getPacketType() == PacketType.Play.Client.ENTITY_ACTION) {
switch (new WrapperPlayClientEntityAction(event).getAction()) {
case START_SNEAKING:
case STOP_SNEAKING:
sneaks++;
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && sneaks > 1) {
if (flagAndAlert("sneak") && shouldModifyPackets()) {
event.setCancelled(true);
player.onPacketCancel();
}
}
break;
case START_SPRINTING:
case STOP_SPRINTING:
sprints++;
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && sprints > 1) {
if (flagAndAlert("sprint") && shouldModifyPackets()) {
event.setCancelled(true);
player.onPacketCancel();
}
}
break;
}
}
}
}
Sounds very specific... BadPackets is good imo
—
Reply to this email directly, view it on GitHub
<#1530 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AICPHKSUSQQEI6XRRKXW5YLZK75UJAVCNFSM6AAAAABJFHJTXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJRG44DGNJWGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
BadPackets makes more sense because it's impossible to send more than 1 sprint packet in a tick, which is what this detects. I'm more concerned about the stability of this on 1.9+. For example, if the simulation falses, we might miss a tick skip, or there is more than 1 skipped tick. |
This can not only be used to check features like WTAP, but cheaters from China like to bypass Grimac. For example, some achieve a 0% 100% (noxz) velocity effect by resetting sprint and sneak, which Using badpackts3 can only detect cheaters before version 1.9. When cheaters cross versions( viaversion to 1.9+), this check will not detect cheaters. So let badpackts3 detect cheaters in version 1.9+? |
1.9+ isn't exempt, it's just more lenient due to tick skipping |
falses while leaving from spectating player (click player while in spectator and next sneak and move you will false) |
|
||
if (!player.skippedTickInActualMovement) { | ||
for (; flags > 0; flags--) { | ||
if (flagAndAlert()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some data in the flag or a bad choice? it would spam both ways so adding something that can help debugging the check wouldn't be a bad idea.
Can detect some wtaps/superknockbacks