Changed the disguisetype fetching to try without _ as well

This commit is contained in:
Andrew
2013-11-06 05:41:34 +13:00
parent d84121c4eb
commit 09e353213e
2 changed files with 38 additions and 32 deletions

View File

@@ -66,10 +66,14 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
sendCommandUsage(sender);
throw new Exception();
}
DisguiseType disguiseType;
try {
disguiseType = DisguiseType.valueOf(args[0].toUpperCase());
} catch (Exception ex) {
DisguiseType disguiseType = null;
for (DisguiseType type : DisguiseType.values()) {
if (args[0].equalsIgnoreCase(type.name()) || type.name().replace("_", "").equalsIgnoreCase(args[0])) {
disguiseType = type;
break;
}
}
if (disguiseType == null) {
throw new Exception(ChatColor.RED + "Error! The disguise " + ChatColor.GREEN + args[0] + ChatColor.RED
+ " doesn't exist!");
}