mirror of
https://github.com/sciwhiz12/Janitor.git
synced 2024-11-10 05:41:27 +00:00
Allow non-nicknamed mentioned users for user argument
This commit is contained in:
parent
29b109fcf6
commit
7f91f78a90
|
@ -17,7 +17,7 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class UserArgument implements ArgumentType<UserArgument.IUserProvider> {
|
public class UserArgument implements ArgumentType<UserArgument.IUserProvider> {
|
||||||
public static final SimpleCommandExceptionType UNKNOWN_USER_IDENTIFIER = new SimpleCommandExceptionType(new LiteralMessage("Unknown user identifier"));
|
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() {
|
public static UserArgument user() {
|
||||||
return new UserArgument();
|
return new UserArgument();
|
||||||
|
@ -29,6 +29,7 @@ public class UserArgument implements ArgumentType<UserArgument.IUserProvider> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IUserProvider parse(StringReader reader) throws CommandSyntaxException {
|
public IUserProvider parse(StringReader reader) throws CommandSyntaxException {
|
||||||
|
int startCursor = reader.getCursor();
|
||||||
if (reader.peek() == '<') { // Expecting a possible user identifier
|
if (reader.peek() == '<') { // Expecting a possible user identifier
|
||||||
int start = reader.getCursor();
|
int start = reader.getCursor();
|
||||||
reader.readStringUntil('>');
|
reader.readStringUntil('>');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user