diff --git a/src/main/java/vc/commands/options/PaginatedOption.java b/src/main/java/vc/commands/options/PaginatedOption.java index a909907..dce7b7c 100644 --- a/src/main/java/vc/commands/options/PaginatedOption.java +++ b/src/main/java/vc/commands/options/PaginatedOption.java @@ -3,11 +3,11 @@ public class PaginatedOption implements ChatInteractionOption { @Override public void apply(final ChatInteractionOptionContext context) { - var pageArg = context.event.getOptionAsLong("page") + int pageArg = context.event.getOptionAsLong("page") .map(Long::intValue) .orElse(1); - if (pageArg <= 0) { - context.setError("Page number must be greater than 0"); + if (pageArg <= 0 || pageArg > 10000) { + context.setError("Page must be greater than 0"); return; } context.page = pageArg; diff --git a/src/main/java/vc/commands/options/PlayerLookupOption.java b/src/main/java/vc/commands/options/PlayerLookupOption.java index 2bc512a..4ec0869 100644 --- a/src/main/java/vc/commands/options/PlayerLookupOption.java +++ b/src/main/java/vc/commands/options/PlayerLookupOption.java @@ -17,7 +17,7 @@ public PlayerLookupOption(final PlayerLookup playerLookup) { public void apply(final ChatInteractionOptionContext context) { var playerNameOptional = context.event.getOptionAsString("player"); if (playerNameOptional.isEmpty()) { - context.setError("Player name option must be set"); + context.setError("Player name required"); return; } String playerName = playerNameOptional.get(); @@ -27,7 +27,7 @@ public void apply(final ChatInteractionOptionContext context) { } Optional playerIdentity = playerLookup.getPlayerIdentity(playerName); if (playerIdentity.isEmpty()) { - context.setError("No player with this name exists"); + context.setError("No player named `" + playerName + "` exists"); return; } context.profileData = playerIdentity.get();