diff --git a/Minecraft.Server.FourKit/Entity/Player.cs b/Minecraft.Server.FourKit/Entity/Player.cs
index 8a6d3356..4499502b 100644
--- a/Minecraft.Server.FourKit/Entity/Player.cs
+++ b/Minecraft.Server.FourKit/Entity/Player.cs
@@ -109,12 +109,10 @@ public class Player : HumanEntity, OfflinePlayer, CommandSender
public ulong getRawOfflineXUID() => _playerRawOfflineXUID;
///
- /// Gets the player's network round trip time in milliseconds.
- /// On the dedicated Windows server this reads the kernel TCP RTT directly
- /// (microsecond precision, untouched by tick scheduler delay). If the OS
- /// query fails it falls back to a smoothed application keepalive value.
+ /// Gets the player's estimated ping in milliseconds.
+ /// This value represents a weighted average of the response time to application layer ping packets sent. This value does not represent the network round trip time and as such may have less granularity and be impacted by other sources. For these reasons it should not be used for anti-cheat purposes. Its recommended use is only as a qualitative indicator of connection quality.
///
- /// The player's RTT in milliseconds, or -1 if unavailable.
+ /// The player's estimated ping in milliseconds.
public int getPing()
{
if (NativeBridge.GetPlayerLatency == null)
diff --git a/Minecraft.Server/FourKitNatives.cpp b/Minecraft.Server/FourKitNatives.cpp
index 7872e0a1..6b3aa189 100644
--- a/Minecraft.Server/FourKitNatives.cpp
+++ b/Minecraft.Server/FourKitNatives.cpp
@@ -19,7 +19,6 @@
#include "../Minecraft.World/Biome.h"
#include "../Minecraft.World/LightLayer.h"
#include "../Minecraft.Client/Windows64/Network/WinsockNetLayer.h"
-#include
#include "../Minecraft.World/AbstractContainerMenu.h"
#include "../Minecraft.World/AddGlobalEntityPacket.h"
#include "../Minecraft.World/ArrayWithLength.h"
@@ -644,33 +643,6 @@ int __cdecl NativeGetPlayerLatency(int entityId)
auto player = FindPlayer(entityId);
if (!player) return -1;
- // Prefer the kernel's TCP round trip when available. Microsecond precision
- // and free of the application-layer tick scheduler delay that smooths
- // player->latency upward by ~one tick interval per direction.
- if (player->connection && player->connection->connection &&
- player->connection->connection->getSocket())
- {
- unsigned char smallId = player->connection->connection->getSocket()->getSmallId();
- if (smallId != 0)
- {
- SOCKET sock = WinsockNetLayer::GetSocketForSmallId(smallId);
- if (sock != INVALID_SOCKET)
- {
- TCP_INFO_v0 info = {};
- DWORD infoVersion = 0;
- DWORD bytesReturned = 0;
- int rc = WSAIoctl(sock, SIO_TCP_INFO,
- &infoVersion, sizeof(infoVersion),
- &info, sizeof(info),
- &bytesReturned, NULL, NULL);
- if (rc == 0 && bytesReturned == sizeof(info))
- {
- return (int)(info.RttUs / 1000);
- }
- }
- }
- }
-
return player->latency;
}
diff --git a/samples/TpsPlugin/TpsPlugin.cs b/samples/TpsPlugin/TpsPlugin.cs
index 824155b2..8291623c 100644
--- a/samples/TpsPlugin/TpsPlugin.cs
+++ b/samples/TpsPlugin/TpsPlugin.cs
@@ -1,13 +1,12 @@
using Minecraft.Server.FourKit;
using Minecraft.Server.FourKit.Command;
-using Minecraft.Server.FourKit.Entity;
using Minecraft.Server.FourKit.Plugin;
namespace TpsPlugin;
///
-/// Minimal informational plugin. Exposes /tps (server tick rate) and /ping
-/// (caller's connection latency).
+/// Minimal plugin exposing /tps. Samples the server tick counter once per
+/// second and reports tick-rate averages over 1s/5s/30s/60s windows.
///
public class TpsPlugin : ServerPlugin
{
@@ -19,15 +18,10 @@ public class TpsPlugin : ServerPlugin
{
TpsProbe.Start();
- var tps = FourKit.getCommand("tps");
- tps.setDescription("Show server TPS over 1s/5s/30s/60s windows.");
- tps.setUsage("/tps");
- tps.setExecutor(new TpsExecutor());
-
- var ping = FourKit.getCommand("ping");
- ping.setDescription("Show your connection ping in milliseconds.");
- ping.setUsage("/ping");
- ping.setExecutor(new PingExecutor());
+ var cmd = FourKit.getCommand("tps");
+ cmd.setDescription("Show server TPS over 1s/5s/30s/60s windows.");
+ cmd.setUsage("/tps");
+ cmd.setExecutor(new TpsExecutor());
}
public override void onDisable()
@@ -127,23 +121,3 @@ internal sealed class TpsExecutor : CommandExecutor
return true;
}
}
-
-internal sealed class PingExecutor : CommandExecutor
-{
- public bool onCommand(CommandSender sender, Command command, string label, string[] args)
- {
- if (sender is not Player player)
- {
- sender.sendMessage("/ping must be run by a player.");
- return true;
- }
- int ping = player.getPing();
- if (ping < 0)
- {
- sender.sendMessage("Ping unavailable.");
- return true;
- }
- sender.sendMessage($"Your ping: {ping}ms");
- return true;
- }
-}