When i used the idle time out command and set it to 99999999, I expected it to take 9999999 minutes to get kicked out, but it took 1 second to get kicked out.
Linked issues
clones 1
Attachments
Comments 4
This seems correct. MinecraftServer#getPlayerIdleTimeout()
returns an int, and ServerGamePacketListenerImpl#tick()
has this piece of code:
...
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long)(this.server.getPlayerIdleTimeout() * 1000 * 60)) {
this.disconnect(Component.translatable("multiplayer.disconnect.idling"));
}
...
This overflows to negative when the timeout is greater than 35791 (35792 * 1000 * 60 > 2147483647, which is the int limit), which means that the player will get instantly kicked out. The timeout should be cast to long first, instead of the whole calculation:
(long)(this.server.getPlayerIdleTimeout()) * 1000 * 60
instead of
(long)(this.server.getPlayerIdleTimeout() * 1000 * 60)
Was that the exact value you set it to? Feels like it overflowed, but even with an overflow, you can't get 1 second with that.