Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BasicCommand won't add an empty string to args when there's a trailing whitespace #11211

Closed
thomasmny opened this issue Aug 4, 2024 · 0 comments · Fixed by #11241
Closed
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. version: 1.21 Game version 1.21

Comments

@thomasmny
Copy link
Contributor

Expected behavior

I have a BasicCommand which I want to get suggestion for.

@Override
public @NotNull Collection<String> suggest(@NotNull CommandSourceStack stack, @NotNull String[] args) {
    if (args.length <= 1) {
        return SuggestionHelper.getSchematicSuggestions(this.schematicDirectory, args);
    }
    return Collections.emptyList();
}

If I've typed in my first argument and then add a space attempting to get the completions for the next argument, I should receive no suggestions since I'm returning an empty list.

Observed/Actual behavior

The player still sees their previous suggestions
Screenshot 2024-08-04 at 21 48 09

Only when a non-whitespace character is added, do the correct suggestions show
Screenshot 2024-08-04 at 21 48 17

Steps/models to reproduce

With the code above (where SuggestionHelper.getSchematicSuggestions(this.schematicDirectory, args); just returns a list with some strings), type in the first argument and then after inputting a space the suggestions will remain

Plugin and Datapack List

Paper Plugins:
- Faberium <- The test plugin
Bukkit Plugins:
- Builders-Utilities, BuildSystem, FastAsyncWorldEdit

Paper version

This server is running Paper version 1.21-124-master@df3b654 (2024-08-02T00:02:38Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21-123-0a1be9a (MC: 1.21)

Other

https://discord.com/channels/289587909051416579/555462289851940864/1269761853723246622

@thomasmny thomasmny added status: needs triage type: bug Something doesn't work as it was intended to. labels Aug 4, 2024
@papermc-sniffer papermc-sniffer bot added the version: 1.21 Game version 1.21 label Aug 4, 2024
@papermc-projects papermc-projects bot moved this to 🕑 Needs Triage in Issues: Bugs Aug 4, 2024
@kennytv kennytv added status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. and removed status: needs triage labels Aug 9, 2024
@papermc-projects papermc-projects bot moved this from 🕑 Needs Triage to ✅ Accepted in Issues: Bugs Aug 9, 2024
@github-project-automation github-project-automation bot moved this from ✅ Accepted to Done in Issues: Bugs Aug 12, 2024
lynxplay pushed a commit that referenced this issue Sep 16, 2024
DersWasTaken pushed a commit to DersWasTaken/Paper that referenced this issue Sep 22, 2024
DersWasTaken pushed a commit to DersWasTaken/Paper that referenced this issue Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. version: 1.21 Game version 1.21
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants