✨ feat(command): add (async) (offline) player argument support#345
✨ feat(command): add (async) (offline) player argument support#345TheBjoRedCraft wants to merge 2 commits into
Conversation
TheBjoRedCraft
commented
May 12, 2026
- implement AsyncOfflinePlayerArgument for non-blocking offline player retrieval
- create OfflinePlayerArgument and PlayerArgument for consistent player argument handling
- update gradle.properties to version 3.10.1
- implement AsyncOfflinePlayerArgument for non-blocking offline player retrieval - create OfflinePlayerArgument and PlayerArgument for consistent player argument handling - update gradle.properties to version 3.10.1
There was a problem hiding this comment.
Pull request overview
Adds new CommandAPI argument helpers in the Paper module to resolve online/offline players consistently, including an async variant intended to avoid blocking offline player lookups, and bumps the project version.
Changes:
- Introduce
PlayerArgument,OfflinePlayerArgument, andAsyncOfflinePlayerArgumentargument types + DSL-style extension functions forCommandTree,Argument, andCommandAPICommand. - Provide tab-completion suggestions for these arguments based on online player names.
- Bump
versionto3.10.1.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| surf-api-paper/surf-api-paper/src/main/kotlin/dev/slne/surf/api/paper/command/args/audience/PlayerArgument.kt | Adds a custom online player argument with suggestions and an error message when not found. |
| surf-api-paper/surf-api-paper/src/main/kotlin/dev/slne/surf/api/paper/command/args/audience/OfflinePlayerArgument.kt | Adds a custom offline player argument with online-name suggestions. |
| surf-api-paper/surf-api-paper/src/main/kotlin/dev/slne/surf/api/paper/command/args/audience/AsyncOfflinePlayerArgument.kt | Adds a coroutine-based async offline player argument using SuspendCustomArgument. |
| gradle.properties | Bumps project version to 3.10.1. |
| CustomArgument<Player, String>(StringArgument(nodeName), { info -> | ||
| Bukkit.getPlayer(info.input)?.takeIf { | ||
| info.sender !is Player || it.canSee(it) | ||
| } ?: throw CustomArgumentException.fromAdventureComponent( |
| this.replaceSuggestions( | ||
| ArgumentSuggestions.stringCollection { viewerInfo -> | ||
| Bukkit.getOnlinePlayers().filter { viewerInfo.sender !is Player || it.canSee(it) } | ||
| .map(Player::getName) | ||
| } |
| init { | ||
| this.replaceSuggestions( | ||
| ArgumentSuggestions.stringCollection { viewerInfo -> | ||
| Bukkit.getOnlinePlayers().filter { viewerInfo.sender !is Player || it.canSee(it) } |
| init { | ||
| this.replaceSuggestions( | ||
| ArgumentSuggestions.stringCollection { viewerInfo -> | ||
| Bukkit.getOnlinePlayers().filter { viewerInfo.sender !is Player || it.canSee(it) } |
|
This PR contains changes that modified the public API. To update the reference ABI dumps: ./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git pushAfter updating, the CI will pass. Make sure the changes are backward compatible. |
- packetevents: 2.11.2 → 2.12.1
|
This PR contains changes that modified the public API. To update the reference ABI dumps: ./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git pushAfter updating, the CI will pass. Make sure the changes are backward compatible. |
|
Paper macht den permission checkt auch: |