diff --git a/src/main/java/io/github/itzispyder/pdk/commands/Args.java b/src/main/java/io/github/itzispyder/pdk/commands/Args.java index 9bd75e2..1aa54ee 100644 --- a/src/main/java/io/github/itzispyder/pdk/commands/Args.java +++ b/src/main/java/io/github/itzispyder/pdk/commands/Args.java @@ -17,10 +17,11 @@ public Arg getAll(int beginIndex) { } public Arg get(int index) { - if (args.length == 0) { - return new Arg(""); - } - return new Arg(args[Math.min(Math.max(index, 0), args.length - 1)]); + if (args.length == 0) + throw new IllegalArgumentException("not enough arguments: arguments are empty"); + if (index < 0 || index >= args.length) + throw new IllegalArgumentException("not enough arguments: argument %s is missing".formatted(index + 1)); + return new Arg(args[index]); } public Arg first() {