Repository navigation
feat: Update NPC visibility logic to filter out non-viewers and incre… - #47
Conversation
…ment Kotlin version to 1.6.11
There was a problem hiding this comment.
🟡 Changes recommended
The filtering logic is correct, but the PR description mislabels the project version bump as a "Kotlin version" change, which should be corrected.
1 open finding
What changed in this PR
This PR adds per-viewer visibility filtering to two NPC refresh listeners so that NPCs restricted to a specific set of viewers are no longer refreshed for players who are not viewers. It also bumps the project version. The visibility semantics match the existing ConnectionListener (a null viewers set means the NPC is global/visible to all, while a non-null set restricts visibility), so the new filter it.viewers?.contains(player.uniqueId) == false correctly skips only NPCs whose non-null viewer set excludes the player.
Changes:
- Skip refreshing NPCs for players not in an NPC's viewer set on world change (
WorldChangeListener) and on async post-teleport (FoliaAdditionsListener). - Bump the project
versionfrom 1.6.10 to 1.6.11 ingradle.properties.
| File | Description |
|---|---|
| surf-npc-paper/src/main/kotlin/dev/slne/surf/npc/paper/listener/WorldChangeListener.kt | Adds viewer filter so non-viewers don't trigger a refresh on world change. |
| surf-npc-paper/src/main/kotlin/dev/slne/surf/npc/paper/listener/FoliaAdditionsListener.kt | Adds the same viewer filter on async post-teleport. |
| gradle.properties | Increments project version 1.6.10 → 1.6.11. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| kotlin.stdlib.default.dependency=false | ||
| org.gradle.parallel=true | ||
| version=1.6.10 | ||
| version=1.6.11 |

…ment Kotlin version to 1.6.11