Fix canSpawnFor to use allMatch insted of anyMatch#50
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughViewerEngine's spawn permission logic was tightened: entity-specific viewer rules now require a non-empty rule list and every rule must allow the user; global viewer rules also require every rule to permit the user before spawning is allowed. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@api/src/main/java/me/tofaa/entitylib/ve/ViewerEngine.java`:
- Around line 123-125: The canSpawnFor method currently ORs entity and global
rule checks causing entities with no local rules to bypass globalRules; update
the method (ViewerEngine.canSpawnFor) to require both rule sets pass by
replacing the current early-return logic with a single combined check: evaluate
entity.getViewerRules().stream().allMatch(rule -> rule.shouldSee(user)) &&
globalRules.stream().allMatch(rule -> rule.shouldSee(user)), and return that
result so both entity-level and global rules must allow spawning.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 53e1da86-0267-4e39-a9ba-7ad6a35c2054
📒 Files selected for processing (1)
api/src/main/java/me/tofaa/entitylib/ve/ViewerEngine.java
https://discord.com/channels/1197504277787201616/1197504277787201619/1487602605231439923
Summary by CodeRabbit