fix: add login checks before sending packet when the state is not PLAY

This commit is contained in:
ChomeNS
2024-12-05 13:37:35 +07:00
parent f2c9d3a30e
commit 7e09ea3257
2 changed files with 5 additions and 1 deletions

View File

@@ -266,10 +266,14 @@ public class ChatPlugin extends Bot.Listener {
}
public void sendCommandInstantly (String command) {
if (!bot.loggedIn) return;
bot.session.send(new ServerboundChatCommandPacket(command));
}
public void sendChatInstantly (String message) {
if (!bot.loggedIn) return;
bot.session.send(new ServerboundChatPacket(
message,
Instant.now().toEpochMilli(),

View File

@@ -43,7 +43,7 @@ public class PositionPlugin extends Bot.Listener {
// notchian clients also does this, sends the position packet every second
bot.executor.scheduleAtFixedRate(() -> {
if (isGoingDownFromHeightLimit) return;
if (!bot.loggedIn || isGoingDownFromHeightLimit) return;
bot.session.send(new ServerboundMovePlayerPosPacket(
false,