From 7f27835c07724f9a48778948e08c6527ea9b1384 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 14 Jul 2014 12:25:37 +1200 Subject: [PATCH] Add int[] to valid params in disguise commands --- .../disguise/commands/DisguiseHelpCommand.java | 2 ++ .../disguise/utilities/BaseDisguiseCommand.java | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java b/src/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java index 2a878496..c5eb19fd 100644 --- a/src/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java @@ -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; diff --git a/src/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java b/src/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java index edfb4a18..094269ca 100644 --- a/src/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java +++ b/src/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java @@ -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; } } }