command-framework
command-framework copied to clipboard
bug: multiple arguments as Optional
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.
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.