Skip to content

Commit 8a8cbf1

Browse files
committed
Add option to try old query protocol
1 parent 8fb29d8 commit 8a8cbf1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/MinecraftQueryResolver.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,24 @@ public static function fromAddress(string $host, $timeout = 2, $resolveSRV = tru
4747
/**
4848
* @throws MinecraftQueryException
4949
*/
50-
public function getResult(): MinecraftQueryResult
50+
public function getResult(bool $tryOldQueryProtocolPre17 = false): MinecraftQueryResult
5151
{
52-
return MinecraftQueryResult::fromRawData($this->getRawData());
52+
return MinecraftQueryResult::fromRawData($this->getRawData($tryOldQueryProtocolPre17));
5353
}
5454

5555
/**
5656
* @throws MinecraftQueryException
5757
*/
58-
public function getRawData(): array
58+
public function getRawData(bool $tryOldQueryProtocolPre17 = false): array
5959
{
6060
if ($this->rawData === null) {
6161
$this->retrieveData();
6262
}
6363

64+
if ($tryOldQueryProtocolPre17 && $this->rawData === null) {
65+
$this->retrieveDataPre17();
66+
}
67+
6468
return $this->rawData;
6569
}
6670

0 commit comments

Comments
 (0)