From 6849a7e1304aa6d7c7023afed7860bc9e07f435e Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 1 Apr 2023 13:55:01 +0700 Subject: [PATCH] actually fix clooping a bit (mabe) --- .../chipmunk/chayapak/chomens_bot/commands/CloopCommand.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CloopCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CloopCommand.java index d4556fb..c7332da 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CloopCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CloopCommand.java @@ -49,8 +49,9 @@ public class CloopCommand implements Command { int interval; try { interval = Integer.parseInt(args[1]); + if (interval < 1) interval = 1; } catch (IllegalArgumentException ignored) { - return Component.text("Invalid index").color(NamedTextColor.RED); + return Component.text("Invalid interval").color(NamedTextColor.RED); } final String command = String.join(" ", Arrays.copyOfRange(args, 2, args.length)); @@ -76,7 +77,7 @@ public class CloopCommand implements Command { Component.text(index).color(NamedTextColor.GOLD) ) ); - } catch (IllegalArgumentException | NullPointerException ignored) { + } catch (IndexOutOfBoundsException | IllegalArgumentException | NullPointerException ignored) { return Component.text("Invalid index").color(NamedTextColor.RED); } }