Demand 'true' or 'false'. Don't allow "fsdfgsd" to be treated as false anymore.

This commit is contained in:
libraryaddict 2014-09-15 01:55:38 +12:00
parent a34ede1104
commit 17822426ab

View File

@ -573,14 +573,15 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
}
}
if (value == null && boolean.class == param) {
// Parse to boolean
if (valueString == null
|| !("true".equalsIgnoreCase(valueString) || "false".equalsIgnoreCase(valueString))) {
if (valueString == null) {
value = true;
i--;
} else {
value = "true".equalsIgnoreCase(valueString);
}
} else if (valueString.equalsIgnoreCase("true")) {
value = true;
} else if (valueString.equalsIgnoreCase("false")) {
value = false;
} else
throw parseToException("true/false", valueString, methodName);
}
if (value != null) {
break;