Closed mve closed 2 years ago
After playing around with the code a bit, I solved the issue by changing the following part in the statusBedrock.ts
file:
// Unconnected ping packet
// https://wiki.vg/Raknet_Protocol#Unconnected_Ping
{
socket.writeByte(0x01);
socket.writeInt64BE(BigInt(Date.now()));
socket.writeBytes(Uint8Array.from([0x00, 0xff, 0xff, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 0xfd, 0xfd, 0xfd, 0x12, 0x34, 0x56, 0x78]));
socket.writeBytes(randomBytes(4));
await socket.flush(false);
}
to
// Unconnected ping packet
// https://wiki.vg/Raknet_Protocol#Unconnected_Ping
{
socket.writeByte(0x01);
socket.writeInt64BE(BigInt(Date.now()));
socket.writeBytes(Uint8Array.from([0x00, 0xff, 0xff, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 0xfd, 0xfd, 0xfd, 0x12, 0x34, 0x56, 0x78]));
socket.writeInt64BE(BigInt(2));
await socket.flush(false);
}
See https://github.com/xPaw/PHP-Minecraft-Query/blob/master/src/MinecraftQuery.php#L208
This issue seems to be fixed in #69 thanks to @fabianwennink. I will go ahead and release 5.2.8
here in a few minutes which will solve this.
Using statusBedrock to get the status for some bedrock servers i noticed many of them were offline. When checking with a different api i found that they were online.
Some example servers that are currently online but hit the default timeout of 5 seconds when using statusBedrock. Increasing the timeout to 10 seconds didn't make a difference.
"host": "bedrock.punchedmc.com", "port": 19132,
"host": "OwnagePE.com", "port": 19132,
"host": "play.hyperlandsmc.net", "port": 19132,
"host": "play.venitymc.com", "port": 19132,
Describe the bug: It is just a regular request to a bedrock server using statusBedrock. It will run for 5 seconds (or whatever the timeout is set to).
Expected behavior: The servers should return the result for an online server.
Additional context Node version 17.3.0 minecraft-server-util version 5.2.7