-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f07772
commit 009422d
Showing
3 changed files
with
56 additions
and
1 deletion.
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
43 changes: 43 additions & 0 deletions
43
src/main/java/ac/grim/grimac/checks/impl/breaking/NoSwingBreak.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,43 @@ | ||
package ac.grim.grimac.checks.impl.breaking; | ||
|
||
import ac.grim.grimac.checks.Check; | ||
import ac.grim.grimac.checks.CheckData; | ||
import ac.grim.grimac.checks.type.BlockBreakCheck; | ||
import ac.grim.grimac.player.GrimPlayer; | ||
import ac.grim.grimac.utils.anticheat.update.BlockBreak; | ||
import com.github.retrooper.packetevents.event.PacketReceiveEvent; | ||
import com.github.retrooper.packetevents.protocol.packettype.PacketType; | ||
import com.github.retrooper.packetevents.protocol.player.DiggingAction; | ||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; | ||
|
||
@CheckData(name = "NoSwingBreak") | ||
public class NoSwingBreak extends Check implements BlockBreakCheck { | ||
public NoSwingBreak(GrimPlayer playerData) { | ||
super(playerData); | ||
} | ||
|
||
private boolean sentAnimation; | ||
private boolean sentBreak; | ||
|
||
@Override | ||
public void onBlockBreak(BlockBreak blockBreak) { | ||
if (blockBreak.action != DiggingAction.CANCELLED_DIGGING) { | ||
sentBreak = true; | ||
} | ||
} | ||
|
||
@Override | ||
public void onPacketReceive(PacketReceiveEvent event) { | ||
if (event.getPacketType() == PacketType.Play.Client.ANIMATION) { | ||
sentAnimation = true; | ||
} | ||
|
||
if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType())) { | ||
if (sentBreak && !sentAnimation) { | ||
flagAndAlert(); | ||
} | ||
|
||
sentAnimation = sentBreak = false; | ||
} | ||
} | ||
} |
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