Skip to content

Commit

Permalink
ignore spectators for BadPacketsR
Browse files Browse the repository at this point in the history
  • Loading branch information
AoElite committed Nov 23, 2023
1 parent 56882b3 commit 2f49a90
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import ac.grim.grimac.player.GrimPlayer;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.player.GameMode;

@CheckData(name = "BadPacketsR", decay = 0.1)
public class BadPacketsR extends Check implements PacketCheck {
Expand All @@ -24,7 +25,8 @@ public void onPacketReceive(final PacketReceiveEvent event) {
long ms = (player.getPlayerClockAtLeast() - clock) / 1000000L;
long diff = (System.currentTimeMillis() - lastTransTime);
if (diff > 2000 && ms > 2000) {
if (positions == 0 && clock != 0) {
//TODO: figure out why spectators are flagging this
if (positions == 0 && clock != 0 && player.gamemode != GameMode.SPECTATOR) {
flagAndAlert("time=" + ms + "ms, " + "lst=" + diff + "ms, positions=" + positions);
} else {
reward();
Expand Down

0 comments on commit 2f49a90

Please sign in to comment.