Skip to content

Commit

Permalink
Fix issue #288 (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
William Braeckman authored Sep 25, 2020
1 parent 65428e3 commit a26babd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/main/java/co/aikar/commands/CommandContexts.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,23 @@ public class CommandContexts<R extends CommandExecutionContext<?, ? extends Comm
registerOptionalContext(CommandHelp.class, (c) -> {
String first = c.getFirstArg();
String last = c.getLastArg();
int page = 1;
Integer page = 1;
List<String> search = null;
if (last != null && ACFUtil.isInteger(last)) {
c.popLastArg();
page = ACFUtil.parseInt(last);
if (page == null) {
throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", last);
}
if (!c.getArgs().isEmpty()) {
search = c.getArgs();
}
} else if (first != null && ACFUtil.isInteger(first)) {
c.popFirstArg();
page = ACFUtil.parseInt(first);
if (page == null){
throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", first);
}
if (!c.getArgs().isEmpty()) {
search = c.getArgs();
}
Expand Down

0 comments on commit a26babd

Please sign in to comment.