Somewhere between SpongeForge 2990 and 2996, this code:
private static final CommandElement TARGET_ELEMENT = firstParsing(
user(Text.of("user")),
string(Text.of("address"))
);
no longer works as it should.
/pay Lemmmy - works properly. user arg is set.
/pay foo@bar - works properly. address arg is set.
/pay Lemmmy - works properly. user arg is set.
/pay foo@bar - errors - says Error occured while executing command: Invalid username foo@bar to the user, and logs this exception to the console.
This does not seem like intended behaviour for firstParsing.
Yep, that needs to be wrapped up in an ArgumentParseException.
Or maybe not throw exceptions when getting a user by invalid name?
We have Optional.empty.
@Faithcaio it used to return Optional.empty(); I believe a recent commit changed this behaviour (possibly accidentally).
Yeah, it's accidental. It's because I try to get an exact match before doing pattern matching to improve performance. I'm working on it now.