better parsing for boolean options
This commit is contained in:
1 parent
8fec0271cc
commit
4b88be0517
1 file changed
+9
-1
@@ -177,7 +177,15 @@ public class MessageCommandContext extends CommandContext {
|
||||
|
||||
value = num;
|
||||
}
|
||||
case BOOLEAN -> value = Boolean.parseBoolean(args[index]);
|
||||
case BOOLEAN -> {
|
||||
String str = args[index];
|
||||
if (str.equalsIgnoreCase("true") || str.equalsIgnoreCase("false")) {
|
||||
value = Boolean.parseBoolean(str);
|
||||
break;
|
||||
}
|
||||
|
||||
invalidateContext(data, "expected true or false");
|
||||
}
|
||||
case NUMBER -> {
|
||||
double num = Long.parseLong(args[index]);
|
||||
if (!choices.isEmpty()) {
|
||||
|
||||
Reference in new issue
Block a user