Accept localized subcommands regardless of whether translate is enabled

This commit is contained in:
PikaMug 2020-04-15 05:00:55 -04:00
parent 6ea64136ec
commit db030a6f12

View File

@ -228,49 +228,48 @@ public class CmdExecutor implements CommandExecutor {
questsHelp(cs); questsHelp(cs);
return true; return true;
} }
boolean translateSubCommands = plugin.getSettings().canTranslateSubCommands(); if (args[0].equalsIgnoreCase("list") || args[0].equalsIgnoreCase(Lang.get("COMMAND_LIST"))) {
if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_LIST") : "list")) {
questsList(cs, args); questsList(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_TAKE") : "take")) { } else if (args[0].equalsIgnoreCase("take") || args[0].equalsIgnoreCase(Lang.get("COMMAND_TAKE"))) {
if (!(cs instanceof Player)) { if (!(cs instanceof Player)) {
cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError")); cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError"));
return true; return true;
} }
questsTake((Player) cs, args); questsTake((Player) cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUIT") : "quit")) { } else if (args[0].equalsIgnoreCase("quit") || args[0].equalsIgnoreCase(Lang.get("COMMAND_QUIT"))) {
if (!(cs instanceof Player)) { if (!(cs instanceof Player)) {
cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError")); cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError"));
return true; return true;
} }
questsQuit((Player) cs, args); questsQuit((Player) cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_STATS") : "stats")) { } else if (args[0].equalsIgnoreCase("stats") || args[0].equalsIgnoreCase(Lang.get("COMMAND_STATS"))) {
if (!(cs instanceof Player)) { if (!(cs instanceof Player)) {
cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError")); cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError"));
return true; return true;
} }
questsStats(cs, null); questsStats(cs, null);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_JOURNAL") : "journal")) { } else if (args[0].equalsIgnoreCase("journal") || args[0].equalsIgnoreCase(Lang.get("COMMAND_JOURNAL"))) {
if (!(cs instanceof Player)) { if (!(cs instanceof Player)) {
cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError")); cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError"));
return true; return true;
} }
questsJournal((Player) cs); questsJournal((Player) cs);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_TOP") : "top")) { } else if (args[0].equalsIgnoreCase("top") || args[0].equalsIgnoreCase(Lang.get("COMMAND_TOP"))) {
questsTop(cs, args); questsTop(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_EDITOR") : "editor")) { } else if (args[0].equalsIgnoreCase("editor") || args[0].equalsIgnoreCase(Lang.get("COMMAND_EDITOR"))) {
if (!(cs instanceof Player)) { if (!(cs instanceof Player)) {
cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError")); cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError"));
return true; return true;
} }
questsEditor(cs); questsEditor(cs);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_EVENTS_EDITOR") } else if (args[0].startsWith("action") || args[0].startsWith("event")
: "actions") || args[0].equalsIgnoreCase("action") || args[0].equalsIgnoreCase("events")) { || args[0].startsWith(Lang.get("COMMAND_EVENTS_EDITOR"))) {
if (!(cs instanceof Player)) { if (!(cs instanceof Player)) {
cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError")); cs.sendMessage(ChatColor.YELLOW + Lang.get("consoleError"));
return true; return true;
} }
questsActions(cs); questsActions(cs);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_INFO") : "info")) { } else if (args[0].equalsIgnoreCase("info") || args[0].equalsIgnoreCase(Lang.get("COMMAND_INFO"))) {
questsInfo(cs); questsInfo(cs);
} else { } else {
cs.sendMessage(ChatColor.YELLOW + Lang.get("questsUnknownCommand")); cs.sendMessage(ChatColor.YELLOW + Lang.get("questsUnknownCommand"));
@ -284,37 +283,41 @@ public class CmdExecutor implements CommandExecutor {
adminHelp(cs); adminHelp(cs);
return true; return true;
} }
boolean translateSubCommands = plugin.getSettings().canTranslateSubCommands(); if (args[0].equalsIgnoreCase("stats") || args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_STATS"))) {
if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats")) {
adminStats(cs, args); adminStats(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give")) { } else if (args[0].equalsIgnoreCase("give") || args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_GIVE"))) {
adminGive(cs, args); adminGive(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit")) { } else if (args[0].equalsIgnoreCase("quit") || args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_QUIT"))) {
adminQuit(cs, args); adminQuit(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points")) { } else if (args[0].equalsIgnoreCase("points")
|| args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_POINTS"))) {
adminPoints(cs, args); adminPoints(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") } else if (args[0].equalsIgnoreCase("takepoints")
: "takepoints")) { || args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS"))) {
adminTakePoints(cs, args); adminTakePoints(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") } else if (args[0].equalsIgnoreCase("givepoints")
: "givepoints")) { || args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS"))) {
adminGivePoints(cs, args); adminGivePoints(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") } else if (args[0].equalsIgnoreCase("pointsall")
: "pointsall")) { || args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_POINTSALL"))) {
adminPointsAll(cs, args); adminPointsAll(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish")) { } else if (args[0].equalsIgnoreCase("finish")
|| args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_FINISH"))) {
adminFinish(cs, args); adminFinish(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") } else if (args[0].equalsIgnoreCase("nextstage")
: "nextstage")) { || args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE"))) {
adminNextStage(cs, args); adminNextStage(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") } else if (args[0].equalsIgnoreCase("setstage")
: "setstage")) { || args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_SETSTAGE"))) {
adminSetStage(cs, args); adminSetStage(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset")) { } else if (args[0].equalsIgnoreCase("reset")
|| args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_RESET"))) {
adminReset(cs, args); adminReset(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove")) { } else if (args[0].equalsIgnoreCase("remove")
|| args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_REMOVE"))) {
adminRemove(cs, args); adminRemove(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload")) { } else if (args[0].equalsIgnoreCase("reload")
|| args[0].equalsIgnoreCase(Lang.get("COMMAND_QUESTADMIN_RELOAD"))) {
adminReload(cs); adminReload(cs);
} else { } else {
cs.sendMessage(ChatColor.YELLOW + Lang.get("questsUnknownAdminCommand")); cs.sendMessage(ChatColor.YELLOW + Lang.get("questsUnknownAdminCommand"));