From 6c61aa49f325e84704cf444693aa8cbe04df0a7d Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sat, 22 Sep 2018 20:38:59 -0400 Subject: [PATCH] Sanity: reset ping ID after getting the right KeepAlive --- .../proxy/connection/backend/VelocityServerConnection.java | 4 ++++ .../proxy/connection/client/ClientPlaySessionHandler.java | 1 + 2 files changed, 5 insertions(+) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java index 5b0a8cf3d..36450f1ea 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java @@ -208,4 +208,8 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation, this.lastPingId = lastPingId; this.lastPingSent = System.currentTimeMillis(); } + + public void resetLastPingId() { + this.lastPingId = -1; + } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java index 81471ffa3..aa27bc1cf 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java @@ -69,6 +69,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { } player.setPing(System.currentTimeMillis() - serverConnection.getLastPingSent()); serverConnection.getMinecraftConnection().write(packet); + serverConnection.resetLastPingId(); return; }