boolean now supports 'yes' and 'no'
This commit is contained in:
@@ -4,21 +4,18 @@ public class BooleanComponent extends ArgumentComponent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object get(String input) {
|
public Object get(String input) {
|
||||||
try {
|
if (input.toLowerCase().equals("true") || input.toLowerCase().equals("yes")) {
|
||||||
return Boolean.parseBoolean(input);
|
return true;
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean valid(String input) {
|
public boolean valid(String input) {
|
||||||
try {
|
if (input.toLowerCase().equals("true") || input.toLowerCase().equals("false") || input.toLowerCase().equals("yes") || input.toLowerCase().equals("no")) {
|
||||||
Boolean.parseBoolean(input);
|
|
||||||
return true;
|
return true;
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user