[Player Counter, MC Java] Use usercache as fallback#128
[Player Counter, MC Java] Use usercache as fallback#128LetterN wants to merge 1 commit intopelican-dev:mainfrom
Conversation
📝 WalkthroughWalkthroughThe Players page now preloads player data from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
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
📒 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)
|
redoing this, making it it pull info from ban, whitelist, usernamecache (or uuid) and also not a webedit pr lol |
use usercache as fallback for the player list (easy ban/unban/admin management)
Summary by CodeRabbit