Fixes player ping w/ configurable timeout keep-alive kick message

This commit is contained in:
Sotr
2018-06-13 15:39:11 +08:00
parent 42a90440b9
commit 3ee0111f24
4 changed files with 6 additions and 16 deletions

View File

@@ -238,4 +238,9 @@ public class AkarinGlobalConfig {
private static void messageBanIp() {
messageBanIp = getString("messages.ban-player-ip", "You have been IP banned.");
}
public static String kickKeepAlive;
private static void kickKeepAlive() {
kickKeepAlive = getString("messages.kick-player-timeout-keep-alive", "Timed out");
}
}

View File

@@ -42,7 +42,7 @@ public class AkarinSlackScheduler extends Thread {
PlayerConnection conn = player.playerConnection;
// Paper - give clients a longer time to respond to pings as per pre 1.12.2 timings
// This should effectively place the keepalive handling back to "as it was" before 1.12.2
long currentTime = System.currentTimeMillis();
long currentTime = System.nanoTime() / 1000000L;
long elapsedTime = currentTime - conn.getLastPing();
if (conn.isPendingPing()) {
// We're pending a ping from the client

View File

@@ -1,14 +0,0 @@
package io.akarin.server.mixin.nsc;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import net.minecraft.server.PlayerConnection;
@Mixin(value = PlayerConnection.class, remap = false)
public class MixinPlayerConnection {
@Overwrite
private long d() {
return System.currentTimeMillis(); // nanoTime() / 1000000L
}
}