1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2026-03-01 05:07:53 +01:00

1 Commits

Author SHA1 Message Date
da206aacb2 wip status protocol 2026-02-23 04:05:44 +01:00
2 changed files with 2 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ static class MinecraftServerStatusProtocol {
await tcpClient.ConnectAsync(IPAddress.Loopback, serverPort, cancellationToken); await tcpClient.ConnectAsync(IPAddress.Loopback, serverPort, cancellationToken);
var tcpStream = tcpClient.GetStream(); var tcpStream = tcpClient.GetStream();
// https://wiki.vg/Server_List_Ping // https://minecraft.wiki/w/Java_Edition_protocol/Server_List_Ping
tcpStream.WriteByte(0xFE); tcpStream.WriteByte(0xFE);
await tcpStream.FlushAsync(cancellationToken); await tcpStream.FlushAsync(cancellationToken);

View File

@@ -61,7 +61,7 @@ sealed class InstancePlayerCountTracker : CancellableBackgroundTask {
try { try {
return await MinecraftServerStatusProtocol.GetPlayerCounts(serverPort, CancellationToken); return await MinecraftServerStatusProtocol.GetPlayerCounts(serverPort, CancellationToken);
} catch (MinecraftServerStatusProtocol.ProtocolException e) { } catch (MinecraftServerStatusProtocol.ProtocolException e) {
Logger.Error("{Message}", e.Message); Logger.Error("Could not check online player count due to protocol error: {Message}", e.Message);
return null; return null;
} catch (SocketException e) { } catch (SocketException e) {
bool waitingForServerStart = e.SocketErrorCode == SocketError.ConnectionRefused && WaitingForFirstDetection; bool waitingForServerStart = e.SocketErrorCode == SocketError.ConnectionRefused && WaitingForFirstDetection;