mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2026-03-01 05:07:53 +01:00
Compare commits
1 Commits
4ad9534d27
...
wip-recipe
| Author | SHA1 | Date | |
|---|---|---|---|
|
da206aacb2
|
@@ -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);
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user