[PR #120] [CLOSED] feat(player-counter): add TeamSpeak 3 ServerQuery support #124

Closed
opened 2026-05-07 00:18:15 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/pelican-dev/plugins/pull/120
Author: @IceCupe123
Created: 4/11/2026
Status: Closed

Base: mainHead: feature/teamspeak-query


📝 Commits (2)

  • 9d17556 feat(player-counter): add TeamSpeak 3 ServerQuery support
  • 6e6eccc fix: resolve PHPStan and Pint CI failures

📊 Changes

3 files changed (+183 additions, -3 deletions)

View changed files

player-counter/src/Extensions/Query/Schemas/TeamSpeakQueryTypeSchema.php (+156 -0)
📝 player-counter/src/Models/GameQuery.php (+25 -3)
📝 player-counter/src/Providers/PlayerCounterPluginProvider.php (+2 -0)

📄 Description

Summary

  • New schema: TeamSpeakQueryTypeSchema — connects via raw TCP to the TeamSpeak 3 ServerQuery interface, reads server name, max clients and connected players, filters out ServerQuery clients (client_type=1), and unescapes TS3 protocol encoding
  • Port resolution hook: GameQuery::runQuery() now checks for an optional resolvePort(Allocation $allocation): ?int method on schemas, allowing them to resolve the query port from server variables instead of relying solely on the query_port_offset. Schemas without this method continue to work exactly as before
  • Hostname alias fix: GameQuery::canRunQuery() and runQuery() now support hostname-based ip_alias values (not just raw IPs), which is required for servers bound to 0.0.0.0 behind a reverse proxy

Why the resolvePort() hook?

TeamSpeak exposes its ServerQuery port as a configurable server variable (QUERY_PORT), independent of the voice port. A static offset would break whenever an admin changes the query port. The hook lets the schema read the actual configured value directly from the server.

The hook is fully backwards-compatible — existing schemas and the query_port_offset field are unaffected.

Test plan

  • TeamSpeak 3 server with default ports (voice: 9987, query: 10011) shows player count widget
  • TeamSpeak 3 server with custom QUERY_PORT uses the correct port
  • Existing query types (Source, Minecraft, etc.) still work as before
  • Server bound to 0.0.0.0 with a hostname ip_alias resolves correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added TeamSpeak 3 ServerQuery support for player count queries.
    • Added support for query-type specific port resolution.
  • Bug Fixes / Reliability

    • Improved IP/alias handling for better network configuration flexibility.
    • More robust query execution with safer failure handling and reporting.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/pelican-dev/plugins/pull/120 **Author:** [@IceCupe123](https://github.com/IceCupe123) **Created:** 4/11/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/teamspeak-query` --- ### 📝 Commits (2) - [`9d17556`](https://github.com/pelican-dev/plugins/commit/9d17556c886ec4523e6368706d13d78bc920bf3c) feat(player-counter): add TeamSpeak 3 ServerQuery support - [`6e6eccc`](https://github.com/pelican-dev/plugins/commit/6e6eccc44cd6d38e12b79fedd6a7d4f145293461) fix: resolve PHPStan and Pint CI failures ### 📊 Changes **3 files changed** (+183 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `player-counter/src/Extensions/Query/Schemas/TeamSpeakQueryTypeSchema.php` (+156 -0) 📝 `player-counter/src/Models/GameQuery.php` (+25 -3) 📝 `player-counter/src/Providers/PlayerCounterPluginProvider.php` (+2 -0) </details> ### 📄 Description ## Summary - **New schema:** `TeamSpeakQueryTypeSchema` — connects via raw TCP to the TeamSpeak 3 ServerQuery interface, reads server name, max clients and connected players, filters out ServerQuery clients (`client_type=1`), and unescapes TS3 protocol encoding - **Port resolution hook:** `GameQuery::runQuery()` now checks for an optional `resolvePort(Allocation $allocation): ?int` method on schemas, allowing them to resolve the query port from server variables instead of relying solely on the `query_port_offset`. Schemas without this method continue to work exactly as before - **Hostname alias fix:** `GameQuery::canRunQuery()` and `runQuery()` now support hostname-based `ip_alias` values (not just raw IPs), which is required for servers bound to `0.0.0.0` behind a reverse proxy ## Why the resolvePort() hook? TeamSpeak exposes its ServerQuery port as a configurable server variable (`QUERY_PORT`), independent of the voice port. A static offset would break whenever an admin changes the query port. The hook lets the schema read the actual configured value directly from the server. The hook is fully backwards-compatible — existing schemas and the `query_port_offset` field are unaffected. ## Test plan - [ ] TeamSpeak 3 server with default ports (voice: 9987, query: 10011) shows player count widget - [ ] TeamSpeak 3 server with custom `QUERY_PORT` uses the correct port - [ ] Existing query types (Source, Minecraft, etc.) still work as before - [ ] Server bound to `0.0.0.0` with a hostname `ip_alias` resolves correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added TeamSpeak 3 ServerQuery support for player count queries. * Added support for query-type specific port resolution. * **Bug Fixes / Reliability** * Improved IP/alias handling for better network configuration flexibility. * More robust query execution with safer failure handling and reporting. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 00:18:15 +02:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/plugins#124
No description provided.