Changed the disguisetype fetching to try without _ as well
This commit is contained in:
parent
d84121c4eb
commit
09e353213e
@ -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!");
|
||||
}
|
||||
|
@ -32,13 +32,17 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
|
||||
// sender.sendMessage(ChatColor.RED + "/disguisehelp <Disguise> <Option>");
|
||||
} else {
|
||||
DisguiseType type = null;
|
||||
try {
|
||||
type = DisguiseType.valueOf(args[0].toUpperCase());
|
||||
} catch (Exception ex) {
|
||||
for (DisguiseType disguiseType : DisguiseType.values()) {
|
||||
if (args[0].equalsIgnoreCase(disguiseType.name())
|
||||
|| disguiseType.name().replace("_", "").equalsIgnoreCase(args[0])) {
|
||||
type = disguiseType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (type == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Cannot find the disguise " + args[0]);
|
||||
return true;
|
||||
}
|
||||
if (type != null) {
|
||||
ArrayList<String> methods = new ArrayList<String>();
|
||||
Class watcher = type.getWatcherClass();
|
||||
try {
|
||||
@ -54,8 +58,8 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
|
||||
valueType = "Number";
|
||||
}
|
||||
if (valueType != null) {
|
||||
methods.add(ChatColor.RED + method.getName() + ChatColor.DARK_RED + " ("
|
||||
+ ChatColor.GREEN + valueType + ChatColor.DARK_RED + ")");
|
||||
methods.add(ChatColor.RED + method.getName() + ChatColor.DARK_RED + " (" + ChatColor.GREEN
|
||||
+ valueType + ChatColor.DARK_RED + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -63,13 +67,11 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
Collections.sort(methods, String.CASE_INSENSITIVE_ORDER);
|
||||
sender.sendMessage(ChatColor.DARK_RED + "Options: "
|
||||
+ StringUtils.join(methods, ChatColor.DARK_RED + ", "));
|
||||
sender.sendMessage(ChatColor.DARK_RED + "Options: " + StringUtils.join(methods, ChatColor.DARK_RED + ", "));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user