@Command("example")
public class ExampleCommand implements OrphanCommand {
@Default
public void onCommand(CommandActor actor,
@Default("1") String anyArgument, @Flag("type") @Optional String type) {
actor.reply("test");
}
}
And if i write:
/example anyText -type
It will throw IndexOutOfBoundsException, not MissingArgumentException.
Stacktrace:
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.LinkedList.checkElementIndex(Unknown Source)
at java.util.LinkedList.remove(Unknown Source)
at revxrsal.commands.core.BaseCommandDispatcher.handleFlag(BaseCommandDispatcher.java:188)
at revxrsal.commands.core.BaseCommandDispatcher.getMethodArguments(BaseCommandDispatcher.java:105)
at revxrsal.commands.core.BaseCommandDispatcher.execute(BaseCommandDispatcher.java:82)
at revxrsal.commands.core.BaseCommandDispatcher.searchCategory(BaseCommandDispatcher.java:69)
at revxrsal.commands.core.BaseCommandDispatcher.eval(BaseCommandDispatcher.java:44)
at revxrsal.commands.core.BaseCommandHandler.dispatch(BaseCommandHandler.java:475)
And i just replaced args.isEmpty with index check. And it`s working in the expected way.
Example:
And if i write: /example anyText -type It will throw IndexOutOfBoundsException, not MissingArgumentException.
Stacktrace:
And i just replaced args.isEmpty with index check. And it`s working in the expected way.