Skip to content

[Player Counter, MC Java] Use usercache as fallback#128

Closed
LetterN wants to merge 1 commit intopelican-dev:mainfrom
LetterN:patch-1
Closed

[Player Counter, MC Java] Use usercache as fallback#128
LetterN wants to merge 1 commit intopelican-dev:mainfrom
LetterN:patch-1

Conversation

@LetterN
Copy link
Copy Markdown

@LetterN LetterN commented May 1, 2026

use usercache as fallback for the player list (easy ban/unban/admin management)

Summary by CodeRabbit

  • Bug Fixes
    • Player list now displays more complete information by combining data from multiple sources.
    • Improved error handling during player data retrieval.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

📝 Walkthrough

Walkthrough

The Players page now preloads player data from usercache.json and merges it with query results, de-duplicating the combined dataset. Error handling for usercache.json decoding is added alongside existing whitelist/ops error management.

Changes

Cohort / File(s) Summary
Player Data Preloading
player-counter/src/Filament/Server/Pages/PlayersPage.php
Modified table records closure to preload players from usercache.json, merge with query results, and de-duplicate. Added error handling for usercache.json decoding failures.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A cache-loaded hop, a query-based leap,
Two player lists merge, de-duped so deep,
Errors caught gently, no crashes tonight—
The Players page hops, now twice as bright! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: using usercache.json as a fallback for the player counter in Minecraft Java servers.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@player-counter/src/Filament/Server/Pages/PlayersPage.php`:
- Around line 111-112: The current dedupe fails because $players entries from
usercache.json set 'id' => uuid while query rows set 'id' => name, so duplicates
remain; modify the mapping and dedupe to normalize by player name: when building
$players (in the array_map callback and where query rows are merged) add a
normalized key like 'norm' => mb_strtolower(trim($data['name'])), then perform
deduplication by keeping the first entry per 'norm' (ensuring usercache-derived
entries are merged/placed before query-derived ones so usercache is preserved),
finally remove the temporary 'norm' field and ensure the final entries use the
intended 'id' and 'name' semantics (preserve uuid on usercache entries and
name-based ids for query rows if needed).
- Around line 109-112: The mapping assumes every decoded row from usercache.json
has 'uuid' and 'name' which can produce malformed player entries; update the try
block in PlayersPage.php (the json_decode -> $players processing) to first
validate and filter the decoded array: ensure each item is an array/object and
contains non-empty string keys 'uuid' and 'name' (e.g., use array_filter to keep
only entries where isset($item['uuid'],$item['name']) and they are strings),
then map the filtered list into ['id'=>..., 'name'=>...]; optionally log or
ignore any skipped rows to aid debugging.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: edd4a7c5-13e8-4bd3-8cf9-355fb6ee954e

📥 Commits

Reviewing files that changed from the base of the PR and between 13bd696 and 1ddfd91.

📒 Files selected for processing (1)
  • player-counter/src/Filament/Server/Pages/PlayersPage.php
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: PHPStan (8.5)
  • GitHub Check: PHPStan (8.2)
  • GitHub Check: PHPStan (8.3)
  • GitHub Check: PHPStan (8.4)

Comment thread player-counter/src/Filament/Server/Pages/PlayersPage.php
Comment thread player-counter/src/Filament/Server/Pages/PlayersPage.php
@LetterN
Copy link
Copy Markdown
Author

LetterN commented May 1, 2026

redoing this, making it it pull info from ban, whitelist, usernamecache (or uuid) and also not a webedit pr lol

@LetterN LetterN closed this May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant