Return the incorrect command usage with a .0 for float/double

This commit is contained in:
Andrew 2013-11-11 03:29:42 +13:00
parent 48efa79ef7
commit c4be1b989e

View File

@ -157,7 +157,14 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
if (types.length == 1) { if (types.length == 1) {
Class param = types[0]; Class param = types[0];
// Parse to number // Parse to number
if (float.class == param || double.class == param || int.class == param) { if (int.class == param) {
if (isNumeric(valueString)) {
value = (int) Integer.parseInt(valueString);
} else {
throw parseToException("number", valueString, methodName);
}
// Parse to boolean
} else if (float.class == param || double.class == param) {
if (isDouble(valueString)) { if (isDouble(valueString)) {
float obj = Float.parseFloat(valueString); float obj = Float.parseFloat(valueString);
if (param == float.class) { if (param == float.class) {
@ -168,7 +175,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
value = (double) obj; value = (double) obj;
} }
} else { } else {
throw parseToException("number", valueString, methodName); throw parseToException("number.0", valueString, methodName);
} }
// Parse to boolean // Parse to boolean
} else if (boolean.class == param) { } else if (boolean.class == param) {