Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

bug: multiple arguments as Optional #9

Open
mluizaa00 opened this issue Apr 12, 2021 · 1 comment
Open

bug: multiple arguments as Optional #9

mluizaa00 opened this issue Apr 12, 2021 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mluizaa00
Copy link
Collaborator

mluizaa00 commented Apr 12, 2021

The @optional annotation can't be used in the middle of arguments

Example:

// annotation here
public void handleCommand(final Context<Player> context, @Optional final String key, final Player target) {
    // code here
}

The key doesn't work at this example. The error sent is the wrong usage message
Otherwise, if the key is not null (contains a input) the command works perfectly.

@saiintbrisson saiintbrisson added enhancement New feature or request good first issue Good for newcomers labels Apr 12, 2021
@saiintbrisson
Copy link
Owner

saiintbrisson commented Apr 12, 2021

This will be a bit tricky to patch. The desired solution would be to implement a pattern system. For now, the argument parser needs to be aware of the succeeding method params, and it has to figure out whether the provided argument can be applied for one of the next params, skipping the current one.

@mluizaa00 mluizaa00 changed the title Multiple arguments as Optional bug: multiple arguments as Optional Jul 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants