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