austriannoah / libpmquery
A Library for querying Minecraft Bedrock Servers
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/austriannoah/libpmquery
Requires
- php: 8.1
This package is auto-updated.
Last update: 2025-10-01 10:13:28 UTC
README
Example Code
<?php namespace AustrianNoah\ExamplePlugin; use austriannoah\libpmquery\PMQuery; use austriannoah\libpmquery\PmQueryException; use pocketmine\plugin\PluginBase; class ExampleCode extends PluginBase { public function onEnable(): void { $this->querySomeServer(); } private function querySomeServer(): void { try { $query = PMQuery::query("geo.hivebedrock.network", 19132); $onlinePlayers = (int) $query["OnlinePlayers"]; $maxPlayers = (int) $query["MaxPlayers"]; $hostName = (string) $query["HostName"]; $this->getLogger()->info("Queried Hive Games"); $this->getLogger()->warning("Online: " . $onlinePlayers); $this->getLogger()->warning("Max: " . $maxPlayers); $this->getLogger()->warning("Host: " . $hostName); } catch (PmQueryException $e) { $this->getLogger()->error($e->getMessage()); } } }