From 6699819b0de122cc94c89dd9cc6f476ab52b4a2b Mon Sep 17 00:00:00 2001 From: Johnluke Francis <77365955+SxmplyJythyy@users.noreply.github.com> Date: Fri, 23 Oct 2026 18:20:45 -0400 Subject: [PATCH 1/3] plugin.json version bump Bumped the version of the plugin from 1.1.0 to 1.2.0 to reflect changes of bedrock query types --- player-counter/plugin.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/player-counter/plugin.json b/player-counter/plugin.json index d5865054..c89a9053 100644 --- a/player-counter/plugin.json +++ b/player-counter/plugin.json @@ -2,7 +2,7 @@ "id": "player-counter", "name": "Player Counter", "author": "Boy132", - "version": "1.1.0", + "version": "1.2.0", "description": "Show the amount of connected players to the server", "category": "plugin", "url": "https://hub.pelican.dev/plugins/player-counter", @@ -19,4 +19,4 @@ "xpaw/php-minecraft-query": "^5.0.0", "xpaw/php-source-query-class": "^6.0.0" } -} \ No newline at end of file +} From 0dd1a44e59b17d3a0bba4d1a52b9d6a973c66195 Mon Sep 17 00:00:00 2001 From: Johnluke Francis <77365955+SxmplyJythyy@users.noreply.github.com> Date: Fri, 23 Oct 2026 18:22:01 -0400 Subject: [PATCH 2/3] Add both RakNet and NetherNet for Bedrock Query Implemented a method to query the NetherNet API for Minecraft Bedrock server information, if not fall back to RakNet --- .../MinecraftBedrockQueryTypeSchema.php | 50 +++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php b/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php index 946dcdf5..5d774393 100644 --- a/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php +++ b/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php @@ -5,6 +5,7 @@ use App\Models\Server; use Boy132\PlayerCounter\Extensions\Query\QueryTypeSchemaInterface; use Exception; +use Illuminate\Support\Facades\Http; use xPaw\MinecraftQuery; class MinecraftBedrockQueryTypeSchema implements QueryTypeSchemaInterface @@ -21,12 +22,56 @@ public function getName(): string /** @return ?array{hostname: string, map: string, current_players: int, max_players: int, players: ?array} */ public function process(Server $server, string $ip, int $port): ?array + { + return $this->tryQueryNetherNet($ip, $port) ?? $this->tryQueryRakNet($ip, $port); + } + + /** @return ?array{hostname: string, map: string, current_players: int, max_players: int, players: null} */ + private function tryQueryNetherNet(string $ip, int $port): ?array + { + try { + $response = Http::acceptJson() + ->connectTimeout(2) + ->timeout(5) + ->get("http://{$ip}:{$port}/v1/join"); + + if (!$response->successful()) { + return null; + } + + $info = $response->json(); + + if ( + !is_array($info) + || !isset( + $info['name'], + $info['level'], + $info['players'], + $info['maxPlayers'], + ) + ) { + return null; + } + + return [ + 'hostname' => $info['name'], + 'map' => $info['level'], + 'current_players' => $info['players'], + 'max_players' => $info['maxPlayers'], + 'players' => null, // Bedrock has no player list + ]; + } catch (Exception) { + return null; // Either invalid or server may use RakNet + } + } + + /** @return ?array{hostname: string, map: string, current_players: int, max_players: int, players: null} */ + private function tryQueryRakNet(string $ip, int $port): ?array { $query = new MinecraftQuery(); try { $query->ConnectBedrock($ip, $port, 5, true); - $info = $query->GetInfo(); if (!is_array($info)) { @@ -42,8 +87,7 @@ public function process(Server $server, string $ip, int $port): ?array ]; } catch (Exception $exception) { report($exception); + return null; } - - return null; } } From d22b7cdd477c2c0adc83ff4f910712b60c1fec48 Mon Sep 17 00:00:00 2001 From: Johnluke Francis <77365955+SxmplyJythyy@users.noreply.github.com> Date: Fri, 23 Oct 2026 18:28:52 -0400 Subject: [PATCH 3/3] Fix formatting issues in MinecraftBedrockQueryTypeSchema Fixed whitespace issues --- .../Query/Schemas/MinecraftBedrockQueryTypeSchema.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php b/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php index 5d774393..cf00b5bd 100644 --- a/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php +++ b/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php @@ -34,7 +34,7 @@ private function tryQueryNetherNet(string $ip, int $port): ?array ->connectTimeout(2) ->timeout(5) ->get("http://{$ip}:{$port}/v1/join"); - + if (!$response->successful()) { return null; } @@ -87,6 +87,7 @@ private function tryQueryRakNet(string $ip, int $port): ?array ]; } catch (Exception $exception) { report($exception); + return null; } }