From b253bb74355493bcd3ac48dd0ef40af5744539c2 Mon Sep 17 00:00:00 2001 From: SamB440 Date: Wed, 20 Dec 2023 17:35:34 +0000 Subject: [PATCH] Fix connection state crash --- src/main/java/ac/grim/grimac/player/GrimPlayer.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/ac/grim/grimac/player/GrimPlayer.java b/src/main/java/ac/grim/grimac/player/GrimPlayer.java index 62d05c3a94..bb2c015b7d 100644 --- a/src/main/java/ac/grim/grimac/player/GrimPlayer.java +++ b/src/main/java/ac/grim/grimac/player/GrimPlayer.java @@ -354,10 +354,9 @@ public void sendTransaction() { } public void sendTransaction(boolean async) { - // don't send transactions in configuration phase - if (user.getDecoderState() == ConnectionState.CONFIGURATION) return; + // don't send transactions outside PLAY phase // Sending in non-play corrupts the pipeline, don't waste bandwidth when anticheat disabled - if (user.getConnectionState() != ConnectionState.PLAY) return; + if (user.getEncoderState() != ConnectionState.PLAY) return; // Send a packet once every 15 seconds to avoid any memory leaks if (disableGrim && (System.nanoTime() - getPlayerClockAtLeast()) > 15e9) {