fix: add login checks before sending packet when the state is not PLAY
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user