Repository navigation
feat(paper): add permissions runtime - #30
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e1d8b6046
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| override fun onlinePlayerIds(): Set<UUID> = | ||
| plugin.server.onlinePlayers.mapTo(mutableSetOf()) { it.uniqueId } |
There was a problem hiding this comment.
Keep Bukkit player enumeration on the main thread
Both the asynchronous refresh task and the NATS subscriber call onlinePlayerIds(), so this method iterates Bukkit's live online-player collection off the server thread. A concurrent join or quit can make that view inconsistent or throw during a sweep/invalidation, skipping permission refreshes. Track UUIDs through main-thread join/quit events or capture the collection synchronously before doing the HTTP work asynchronously.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
| environment["GROUNDS_PERMISSION_SERVER_TYPE"]?.takeIf(String::isNotBlank) | ||
| ?: "paper", |
There was a problem hiding this comment.
Do not invent a Paper server type when none is configured
When the optional GROUNDS_PERMISSION_SERVER_TYPE variable is omitted, this sends serverType=paper with every snapshot request and uses the same literal value for local scope resolution. Server types represent workload scopes such as lobby or survival, not the implementation platform, so otherwise valid server-type grants are filtered out and fail permission checks on an ordinarily configured Paper server. Leave the value unset as Velocity does, or require/provide the server's actual logical type.
Useful? React with 👍 / 👎.
Pull Request
Description
Adds a Paper runtime for Grounds permission snapshots. It reuses the common REST client, resolver, cache, scheduled refresh and NATS invalidation lifecycle, fails closed during pre-login, and publishes the common
Permissionsservice through Bukkit'sServicesManager.For compatibility with ordinary Bukkit plugins, the runtime materializes every permission registered with Paper into one
PermissionAttachmentper online player. This makes normalplayer.hasPermission(...)checks use Grounds decisions, including explicit deny, wildcard matching and scoped precedence. Attachments are reapplied after refreshes, invalidations and plugin enable events, then removed on quit and shutdown. Nodes that are never registered with Bukkit remain available through the GroundsPermissionsservice because Paper exposes no stable hook for intercepting arbitrary unregistered checks.The release data image preserves the Velocity artifact at
/jar/plugin.jarand additionally publishes the shaded Paper artifact at/jar/paper.jar. Chat, tab-list and prefix formatting remain outside this plugin.Type of Change
Related Issues
Testing
Commands and checks:
./gradlew spotlessCheck check :paper:shadowJar--rerun-tasks/jar/plugin.jarand/jar/paper.jarChecklist