Skip to content

Commit

Permalink
rephrase error message
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Nov 21, 2024
1 parent 6672d7f commit 6f5fc50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/main/java/vc/commands/options/PaginatedOption.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/vc/commands/options/PlayerLookupOption.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -27,7 +27,7 @@ public void apply(final ChatInteractionOptionContext context) {
}
Optional<ProfileData> 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();
Expand Down

0 comments on commit 6f5fc50

Please sign in to comment.