Fixed player getting "Timed out" while standing still due to Keep-Alive not being sent correctly \\ Replaced return with canceling the task (oops).

This commit is contained in:
Zhyren-git 2025-12-17 18:20:55 -04:00
parent df47c40998
commit 33dacf02db
1 changed files with 2 additions and 2 deletions

View File

@ -569,14 +569,14 @@ public class ClientConnection extends Thread {
keepAliveTask = new TimerTask() { keepAliveTask = new TimerTask() {
@Override @Override
public void run() { public void run() {
if (state != ClientState.PLAY || !ready) return; if (state != ClientState.PLAY || !ready) this.cancel(); // oops
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
PacketPlayOutKeepAlive keepAlive = new PacketPlayOutKeepAlive(now); PacketPlayOutKeepAlive keepAlive = new PacketPlayOutKeepAlive(now);
try { try {
sendPacket(keepAlive); sendPacket(keepAlive);
setLastKeepAlivePayLoad(now); setLastKeepAlivePayLoad(now);
} catch (IOException ignored) {} } catch (IOException ignored) {cancel();}
} }
}; };