Fixes player ping w/ configurable timeout keep-alive kick message
This commit is contained in:
@@ -238,4 +238,9 @@ public class AkarinGlobalConfig {
|
|||||||
private static void messageBanIp() {
|
private static void messageBanIp() {
|
||||||
messageBanIp = getString("messages.ban-player-ip", "You have been IP banned.");
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class AkarinSlackScheduler extends Thread {
|
|||||||
PlayerConnection conn = player.playerConnection;
|
PlayerConnection conn = player.playerConnection;
|
||||||
// Paper - give clients a longer time to respond to pings as per pre 1.12.2 timings
|
// 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
|
// 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();
|
long elapsedTime = currentTime - conn.getLastPing();
|
||||||
if (conn.isPendingPing()) {
|
if (conn.isPendingPing()) {
|
||||||
// We're pending a ping from the client
|
// We're pending a ping from the client
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
"cps.MixinCraftWorld",
|
"cps.MixinCraftWorld",
|
||||||
"cps.MixinChunkProviderServer",
|
"cps.MixinChunkProviderServer",
|
||||||
|
|
||||||
"nsc.MixinPlayerConnection",
|
|
||||||
"nsc.OptimisticNetworkManager",
|
"nsc.OptimisticNetworkManager",
|
||||||
"nsc.NonblockingServerConnection",
|
"nsc.NonblockingServerConnection",
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user