Two deliverables in one repo:
- QueryServerCore (virion/library): async HTTP (api.mcsrvstat.us v3) + UDP fallback (libpmquery) with a tiny callback-based API for other plugins.
- QueryServer (plugin): thin wrapper exposing
/querycommand that uses the core.
- Async HTTP query (no main-thread blocking) with automatic UDP fallback.
- Embedded, namespaced libpmquery.
- Callback API for other plugins (no promises/futures needed).
/query <domain/ip[:port]> [port]
Example:/query test.pmmp.io 19132
use NhanAZ\QueryServer\Main;
$api = Main::getInstance()->getApi();
$api->query("test.pmmp.io", 19132, function(array $result): void {
if (($result['ok'] ?? false) === true) {
// $result['source'] === 'api' or 'udp'
// $result['data'] : API status object (api) or UDP array (udp)
} else {
// $result['error']
}
});- Download the
QueryServerphar. - Drop into
plugins/(PocketMine-MP 5.x / PHP 8.1+).
Add dependency in .poggit.yml:
libs:
- src: NhanAZ-Libraries/QueryServer/QueryServerCore
version: ^0.0.3- See
examples/QueryConsumerfor a minimal plugin that depends onQueryServerand runs/qtestto querytest.pmmp.io:19132via the API.
- LGPL-3.0-or-later.
- Bundled libpmquery (LGPL-3.0-or-later) by jasonw4331/libpmquery.