Added missing bounds check to dice maximum range.
This commit is contained in:
@@ -40,6 +40,12 @@ public final class Dice implements Command {
|
||||
.setDeletionDelay(30, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
if (maximumRange < 1) {
|
||||
return new CommandResponse("x",
|
||||
"Sorry " + executor.getAsMention() + ", but the maximum range must be at least 1.")
|
||||
.setDeletionDelay(30, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
return new CommandResponse("game_die",
|
||||
executor.getAsMention() + ", the dice rolled **" + (rng.nextInt(maximumRange) + 1) + "**.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user