Fixed is assignable for the disguise options

This commit is contained in:
Andrew 2013-11-06 04:24:07 +13:00
parent 16f73be312
commit 352c53c96e
2 changed files with 6 additions and 6 deletions

View File

@ -147,15 +147,15 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
Class<?>[] types = method.getParameterTypes(); Class<?>[] types = method.getParameterTypes();
if (types.length == 1) { if (types.length == 1) {
Class param = types[0]; Class param = types[0];
if ((param.isAssignableFrom(Float.class) || param.isAssignableFrom(Integer.class) || param if (Float.class.isAssignableFrom(param) || Double.class.isAssignableFrom(param)
.isAssignableFrom(Double.class))) { || Integer.class.isAssignableFrom(param)) {
if (isDouble(valueString)) { if (isDouble(valueString)) {
value = param.cast(Float.parseFloat(valueString)); value = param.cast(Float.parseFloat(valueString));
} else { } else {
throw new Exception(ChatColor.RED + "Expected a number, received " + valueString throw new Exception(ChatColor.RED + "Expected a number, received " + valueString
+ " instead for " + methodName); + " instead for " + methodName);
} }
} else if (param.isAssignableFrom(boolean.class)) { } else if (Boolean.class.isAssignableFrom(param)) {
try { try {
Boolean.parseBoolean(valueString); Boolean.parseBoolean(valueString);
} catch (Exception ex) { } catch (Exception ex) {

View File

@ -48,10 +48,10 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
String valueType = null; String valueType = null;
if (c == String.class) if (c == String.class)
valueType = "String"; valueType = "String";
else if (c.isAssignableFrom(Boolean.class)) else if (Boolean.class.isAssignableFrom(c))
valueType = "True/False"; valueType = "True/False";
else if (c.isAssignableFrom(Float.class) || c.isAssignableFrom(Double.class) else if (Float.class.isAssignableFrom(c) || Double.class.isAssignableFrom(c)
|| c.isAssignableFrom(Integer.class)) { || Integer.class.isAssignableFrom(c)) {
valueType = "Number"; valueType = "Number";
} }
if (valueType != null) { if (valueType != null) {