Fixed up the option checking codes

This commit is contained in:
Andrew
2013-11-06 04:34:38 +13:00
parent ff5426ffb8
commit 742b072c2b
2 changed files with 8 additions and 9 deletions

View File

@@ -141,21 +141,20 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
Method methodToUse = null;
Object value = null;
for (Method method : disguise.getWatcher().getClass().getMethods()) {
if (method.getName().equalsIgnoreCase(methodName)) {
if (!method.getName().startsWith("get") && method.getName().equalsIgnoreCase(methodName)) {
methodToUse = method;
methodName = method.getName();
Class<?>[] types = method.getParameterTypes();
if (types.length == 1) {
Class param = types[0];
if (Float.class.isAssignableFrom(param) || Double.class.isAssignableFrom(param)
|| Integer.class.isAssignableFrom(param)) {
if (float.class == param || double.class == param || int.class == param) {
if (isDouble(valueString)) {
value = param.cast(Float.parseFloat(valueString));
} else {
throw new Exception(ChatColor.RED + "Expected a number, received " + valueString
+ " instead for " + methodName);
}
} else if (Boolean.class.isAssignableFrom(param)) {
} else if (boolean.class == param) {
try {
Boolean.parseBoolean(valueString);
} catch (Exception ex) {