From 7f91f78a9026271692c79c97256bbd4f1a3c2000 Mon Sep 17 00:00:00 2001 From: Arnold Alejo Nunag Date: Tue, 15 Sep 2020 00:58:32 +0800 Subject: [PATCH] Allow non-nicknamed mentioned users for user argument --- .../sciwhiz12/janitor/commands/arguments/UserArgument.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/sciwhiz12/janitor/commands/arguments/UserArgument.java b/src/main/java/sciwhiz12/janitor/commands/arguments/UserArgument.java index d43d3bf..a843fe8 100644 --- a/src/main/java/sciwhiz12/janitor/commands/arguments/UserArgument.java +++ b/src/main/java/sciwhiz12/janitor/commands/arguments/UserArgument.java @@ -17,7 +17,7 @@ import java.util.regex.Pattern; public class UserArgument implements ArgumentType { public static final SimpleCommandExceptionType UNKNOWN_USER_IDENTIFIER = new SimpleCommandExceptionType(new LiteralMessage("Unknown user identifier")); - public static final Pattern USER_IDENTIFIER_PATTERN = Pattern.compile("<@!([0-9]+)>"); + public static final Pattern USER_IDENTIFIER_PATTERN = Pattern.compile("<@!?([0-9]+)>"); public static UserArgument user() { return new UserArgument(); @@ -29,6 +29,7 @@ public class UserArgument implements ArgumentType { @Override public IUserProvider parse(StringReader reader) throws CommandSyntaxException { + int startCursor = reader.getCursor(); if (reader.peek() == '<') { // Expecting a possible user identifier int start = reader.getCursor(); reader.readStringUntil('>');