Add int[] to valid params in disguise commands

This commit is contained in:
libraryaddict 2014-07-14 12:25:37 +12:00
parent dcd85b88ea
commit 7f27835c07
2 changed files with 13 additions and 0 deletions

View File

@ -204,6 +204,8 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
valueType = "Villager Profession";
} else if (PotionEffectType.class == c) {
valueType = "Potion effect";
} else if (c == int[].class) {
valueType = "number,number,number...";
}
if (valueType != null) {
ChatColor methodColor = ChatColor.YELLOW;

View File

@ -541,6 +541,17 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
} catch (Exception ex) {
throw parseToException("a potioneffect type", valueString, methodName);
}
} else if (param == int[].class) {
String[] split = valueString.split(",");
int[] values = new int[split.length];
for (int b = 0; b < values.length; b++) {
try {
values[b] = Integer.parseInt(split[b]);
} catch (NumberFormatException ex) {
throw parseToException("Number,Number,Number...", valueString, methodName);
}
}
value = values;
}
}
}