-
Notifications
You must be signed in to change notification settings - Fork 355
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 autoblock check #1467
base: 2.0
Are you sure you want to change the base?
add autoblock check #1467
Conversation
Hello man! What does this line do in the config?
|
Personal preference |
Was this tested? And the one in the config fairly sure it does nothing?? |
It has been tested in 0ms, 30ms, 80ms, 160ms, and 200ms environments |
Server & client version?? |
|
I see, I used to develop other anti-cheats when the flagAndAlert() method can be used to setback directly, but grim is different, I'm going to re-push the code |
When you cancel packets you need to check if it flags & use the method that checks if it should modify packets. Also since you are using bukkit methods to check if they are blocking it's probably going to false with latency. |
|
||
//Even blocking due to a delay will send Interact before then | ||
if (wrapper.getAction().equals(WrapperPlayClientInteractEntity.InteractAction.ATTACK)) { | ||
if (this.player.bukkitPlayer.isBlocking()) { |
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.
use player.packetStateData.slowedByUsingItem
to avoid falses due to desync like https://github.com/GrimAnticheat/Grim/blob/2.0/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAttack.java#L48
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.
I've tried slowedByUseItem, but it doesn't work
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.
I've tried slowedByUseItem, but it doesn't work
Try handling it right after BadPacketsW in https://github.com/GrimAnticheat/Grim/blob/2.0/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAttack.java
if (wrapper.getEntityId() != this.lastInteractEntity) { | ||
if (isAboveSetbackVl()) this.player.getSetbackTeleportUtil().executeNonSimulatingSetback(); | ||
flagAndAlert(); | ||
event.setCancelled(true); |
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.
Replace this with
if (shouldModifyPackets()) {
event.setCancelled(true);
player.onPacketCancel();
}
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.
thanks
import com.github.retrooper.packetevents.protocol.packettype.PacketType; | ||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; | ||
|
||
@CheckData(name = "AutoBlockA (Interact)",configName = "AutoBlock",setback = 1) |
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 spaces between the commas
if (wrapper.getAction().equals(WrapperPlayClientInteractEntity.InteractAction.ATTACK)) { | ||
if (this.player.bukkitPlayer.isBlocking()) { | ||
if (this.lastUseItem == -1L && this.useItem == -1L) { | ||
this.useItem = this.player.lastBlockPlaceUseItem; |
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.
This only works on 1.8 servers iirc
if (event.getPacketType().equals(PacketType.Play.Client.INTERACT_ENTITY)) { | ||
WrapperPlayClientInteractEntity wrapper = new WrapperPlayClientInteractEntity(event); | ||
if (wrapper.getAction().equals(WrapperPlayClientInteractEntity.InteractAction.ATTACK)) { | ||
if (this.player.bukkitPlayer.isBlocking()) { |
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.
Again, use player.packetStateData.slowedByUsingItem to avoid falses due to desync like https://github.com/GrimAnticheat/Grim/blob/2.0/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAttack.java#L48
|
||
//vanilla is unable to do blocking when sending more than two interact_entity packets | ||
if (this.useItem == this.lastUseItem) { | ||
setbackIfAboveSetbackVL(); |
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.
Again, why setback?
import com.github.retrooper.packetevents.protocol.packettype.PacketType; | ||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; | ||
|
||
@CheckData(name = "AutoBlockB (MultiActions)",configName = "AutoBlock",setback = 1) |
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.
Again, add spaces
//vanilla is unable to do blocking when sending more than two interact_entity packets | ||
if (this.useItem == this.lastUseItem) { | ||
setbackIfAboveSetbackVL(); | ||
flagAndAlert("Duplicate tick"); |
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.
Why add verbose when the verbose is always the same?
if (wrapper.getAction().equals(WrapperPlayClientInteractEntity.InteractAction.ATTACK)) { | ||
if (this.player.bukkitPlayer.isBlocking()) { | ||
if (wrapper.getEntityId() != this.lastInteractEntity) { | ||
setbackIfAboveSetbackVL(); |
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.
Why setback?
setbackIfAboveSetbackVL(); | ||
flagAndAlert(); | ||
event.setCancelled(true); |
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.
flagAndAlert()
returns something, check it before you do anything
if (flagAndAlert()) {
...
}
setbackIfAboveSetbackVL(); | ||
flagAndAlert("Duplicate tick"); |
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.
if (flagAndAlert("Duplicate tick")) {
setbackIfAboveSetbackVL();
}
i will recode it |
|
||
//Even blocking due to a delay will send Interact before then | ||
if (wrapper.getAction().equals(WrapperPlayClientInteractEntity.InteractAction.ATTACK)) { | ||
if (this.player.packetStateData.slowedByUsingItem || this.player.packetStateData.wasSlowedByUsingItem) { |
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.
wasSlowedByUsingItem was added to patch switchitem noslow, and is only updated every client tick and on slot changes, this could cause false positives.
AutoBlockB is easily falsable https://streamable.com/yto3z0 |
this.lastUseItem = this.useItem; | ||
return; | ||
} | ||
alert("useItem=" + this.useItem + ", lastUseItem=" + this.lastUseItem); |
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.
unless if this is for debug, this should be flagAndAlert, not just alert
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.
Since I couldn't find a debug method in grim, I just used alert instead
import com.github.retrooper.packetevents.protocol.packettype.PacketType; | ||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; | ||
|
||
@CheckData(name = "AutoBlockB (MultiActions)", configName = "AutoBlock", setback = 1) |
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.
separate AutoBlockA and AutoBlockB in the config
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.
okay
Please solve the conflicts and put this PR as draft; and you should probably handle 1.9+ servers/clients (second hand; shield, etcetera) at the same time. |
This check has been tested in 1.9+. |
If this gets merged we should rename BadPacketsV to AutoBlockC |
3 things:
|
No description provided.