Fix keepalive time interval (#10690)

This commit is contained in:
Jake Potrebic 2024-05-10 17:23:58 -07:00
parent 8a5f5f023a
commit df292ced7a
2 changed files with 4 additions and 4 deletions

View File

@ -154,8 +154,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected void keepConnectionAlive() {
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
if (!this.isSingleplayerOwner() && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected
if (this.keepAlivePending && !this.processedDisconnect) { // Paper
if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets
if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected
- this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE);
+ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
} else if (this.checkIfClosed(currentTime)) { // Paper

View File

@ -49,8 +49,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (!this.isSingleplayerOwner() && i - this.keepAliveTime >= 25000L) { // CraftBukkit
- if (this.keepAlivePending) {
+ if (!this.isSingleplayerOwner() && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected
+ if (this.keepAlivePending && !this.processedDisconnect) { // Paper
+ if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets
+ if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected
this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE);
- } else if (this.checkIfClosed(i)) {
+ } else if (this.checkIfClosed(currentTime)) { // Paper