Skip to content

✨ feat(command): add (async) (offline) player argument support#345

Closed
TheBjoRedCraft wants to merge 2 commits into
version/26.1from
feat/get-those-nice-player-arguments-back
Closed

✨ feat(command): add (async) (offline) player argument support#345
TheBjoRedCraft wants to merge 2 commits into
version/26.1from
feat/get-those-nice-player-arguments-back

Conversation

@TheBjoRedCraft

Copy link
Copy Markdown
Member
  • 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and AsyncOfflinePlayerArgument argument types + DSL-style extension functions for CommandTree, Argument, and CommandAPICommand.
  • Provide tab-completion suggestions for these arguments based on online player names.
  • Bump version to 3.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.

Comment on lines +14 to +17
CustomArgument<Player, String>(StringArgument(nodeName), { info ->
Bukkit.getPlayer(info.input)?.takeIf {
info.sender !is Player || it.canSee(it)
} ?: throw CustomArgumentException.fromAdventureComponent(
Comment on lines +24 to +28
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) }
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ API/ABI changes detected!

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 push

After updating, the CI will pass. Make sure the changes are backward compatible.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ API/ABI changes detected!

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 push

After updating, the CI will pass. Make sure the changes are backward compatible.

@twisti-dev

Copy link
Copy Markdown
Contributor

@twisti-dev twisti-dev closed this May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants