5
5
import ac .grim .grimac .checks .type .BlockBreakCheck ;
6
6
import ac .grim .grimac .player .GrimPlayer ;
7
7
import ac .grim .grimac .utils .anticheat .update .BlockBreak ;
8
- import ac .grim .grimac .utils .nmsutil .BlockBreakSpeed ;
9
8
import com .github .retrooper .packetevents .protocol .item .type .ItemTypes ;
10
9
import com .github .retrooper .packetevents .protocol .player .ClientVersion ;
11
10
import com .github .retrooper .packetevents .protocol .player .DiggingAction ;
@@ -26,19 +25,19 @@ public void onBlockBreak(BlockBreak blockBreak) {
26
25
return ;
27
26
}
28
27
29
- final boolean invalid ;
30
-
31
28
final StateType block = blockBreak .block .getType ();
32
29
33
- if ( blockBreak . action == DiggingAction . FINISHED_DIGGING ) {
34
- invalid = BlockBreakSpeed . getBlockDamage ( player , blockBreak . position ) >= 1 || block . getHardness () == - 1.0f ;
35
- } else invalid = (block == StateTypes .LIGHT && !(player .getInventory ().getHeldItem ().is (ItemTypes .LIGHT ) || player .getInventory ().getOffHand ().is (ItemTypes .LIGHT )))
30
+ // the block does not have a hitbox
31
+ boolean invalid =
32
+ (block == StateTypes .LIGHT && !(player .getInventory ().getHeldItem ().is (ItemTypes .LIGHT ) || player .getInventory ().getOffHand ().is (ItemTypes .LIGHT )))
36
33
|| block .isAir ()
37
34
|| block == StateTypes .WATER
38
35
|| block == StateTypes .LAVA
39
36
|| block == StateTypes .BUBBLE_COLUMN
40
37
|| block == StateTypes .MOVING_PISTON
41
- || (block == StateTypes .FIRE && noFireHitbox );
38
+ || (block == StateTypes .FIRE && noFireHitbox )
39
+ // or the client claims to have broken an unbreakable block
40
+ || block .getHardness () == -1.0f && blockBreak .action == DiggingAction .FINISHED_DIGGING ;
42
41
43
42
if (invalid && flagAndAlert ("block=" + block .getName () + ", type=" + blockBreak .action ) && shouldModifyPackets ()) {
44
43
blockBreak .cancel ();
0 commit comments