diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 83aa4c433..37efc8e3b 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -40,11 +40,12 @@ public class CommandManager { /** * Constructor. * - * @param registerCommands True to register the commands, false otherwise. + * @param registerCommands + * True to register the commands, false otherwise. */ public CommandManager(boolean registerCommands) { // Register the commands - if(registerCommands) + if (registerCommands) registerCommands(); } @@ -54,573 +55,504 @@ public class CommandManager { @SuppressWarnings({ "serial" }) public void registerCommands() { // Register the base AuthMe Reloaded command - CommandDescription authMeBaseCommand = new CommandDescription( - new AuthMeCommand(), - new ArrayList() {{ - add("authme"); - }}, - "Main command", - "The main AuthMeReloaded command. The root for all admin commands.", null); + CommandDescription authMeBaseCommand = new CommandDescription(new AuthMeCommand(), new ArrayList() { + + { + add("authme"); + } + }, "Main command", "The main AuthMeReloaded command. The root for all admin commands.", null); // Register the help command - CommandDescription authMeHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded commands.", - authMeBaseCommand); + CommandDescription authMeHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded commands.", authMeBaseCommand); authMeHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); authMeHelpCommand.setMaximumArguments(false); // Register the register command - CommandDescription registerCommand = new CommandDescription( - new RegisterCommand(), - new ArrayList() {{ - add("register"); - add("reg"); - add("r"); - }}, - "Register a player", - "Register the specified player with the specified password.", - authMeBaseCommand); + CommandDescription registerCommand = new CommandDescription(new RegisterCommand(), new ArrayList() { + + { + add("register"); + add("reg"); + add("r"); + } + }, "Register a player", "Register the specified player with the specified password.", authMeBaseCommand); registerCommand.setCommandPermissions("authme.admin.register", CommandPermissions.DefaultPermission.OP_ONLY); registerCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); registerCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); // Register the unregister command - CommandDescription unregisterCommand = new CommandDescription( - new UnregisterCommand(), - new ArrayList() {{ - add("unregister"); - add("unreg"); - add("unr"); - add("delete"); - add("del"); - }}, - "Unregister a player", - "Unregister the specified player.", - authMeBaseCommand); + CommandDescription unregisterCommand = new CommandDescription(new UnregisterCommand(), new ArrayList() { + + { + add("unregister"); + add("unreg"); + add("unr"); + add("delete"); + add("del"); + } + }, "Unregister a player", "Unregister the specified player.", authMeBaseCommand); unregisterCommand.setCommandPermissions("authme.admin.unregister", CommandPermissions.DefaultPermission.OP_ONLY); unregisterCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); // Register the forcelogin command - CommandDescription forceLoginCommand = new CommandDescription( - new ForceLoginCommand(), - new ArrayList() {{ - add("forcelogin"); - add("login"); - }}, - "Enforce login player", - "Enforce the specified player to login.", - authMeBaseCommand); + CommandDescription forceLoginCommand = new CommandDescription(new ForceLoginCommand(), new ArrayList() { + + { + add("forcelogin"); + add("login"); + } + }, "Enforce login player", "Enforce the specified player to login.", authMeBaseCommand); forceLoginCommand.setCommandPermissions("authme.admin.forcelogin", CommandPermissions.DefaultPermission.OP_ONLY); forceLoginCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); // Register the changepassword command - CommandDescription changePasswordCommand = new CommandDescription( - new ChangePasswordCommand(), - new ArrayList() {{ - add("password"); - add("changepassword"); - add("changepass"); - add("cp"); - }}, - "Change player's password", - "Change the password of a player.", - authMeBaseCommand); + CommandDescription changePasswordCommand = new CommandDescription(new ChangePasswordCommand(), new ArrayList() { + + { + add("password"); + add("changepassword"); + add("changepass"); + add("cp"); + } + }, "Change player's password", "Change the password of a player.", authMeBaseCommand); changePasswordCommand.setCommandPermissions("authme.admin.changepassword", CommandPermissions.DefaultPermission.OP_ONLY); changePasswordCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); changePasswordCommand.addArgument(new CommandArgumentDescription("pwd", "New password", false)); // Register the purge command - CommandDescription lastLoginCommand = new CommandDescription( - new LastLoginCommand(), - new ArrayList() {{ - add("lastlogin"); - add("ll"); - }}, - "Player's last login", - "View the date of the specified players last login", - authMeBaseCommand); + CommandDescription lastLoginCommand = new CommandDescription(new LastLoginCommand(), new ArrayList() { + + { + add("lastlogin"); + add("ll"); + } + }, "Player's last login", "View the date of the specified players last login", authMeBaseCommand); lastLoginCommand.setCommandPermissions("authme.admin.lastlogin", CommandPermissions.DefaultPermission.OP_ONLY); lastLoginCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); // Register the accounts command - CommandDescription accountsCommand = new CommandDescription( - new AccountsCommand(), - new ArrayList() {{ - add("accounts"); - add("account"); - }}, - "Display player accounts", - "Display all accounts of a player by it's player name or IP.", - authMeBaseCommand); + CommandDescription accountsCommand = new CommandDescription(new AccountsCommand(), new ArrayList() { + + { + add("accounts"); + add("account"); + } + }, "Display player accounts", "Display all accounts of a player by it's player name or IP.", authMeBaseCommand); accountsCommand.setCommandPermissions("authme.admin.accounts", CommandPermissions.DefaultPermission.OP_ONLY); accountsCommand.addArgument(new CommandArgumentDescription("player", "Player name or IP", true)); // Register the getemail command - CommandDescription getEmailCommand = new CommandDescription( - new GetEmailCommand(), - new ArrayList() {{ - add("getemail"); - add("getmail"); - add("email"); - add("mail"); - }}, - "Display player's email", - "Display the email address of the specified player if set.", - authMeBaseCommand); + CommandDescription getEmailCommand = new CommandDescription(new GetEmailCommand(), new ArrayList() { + + { + add("getemail"); + add("getmail"); + add("email"); + add("mail"); + } + }, "Display player's email", "Display the email address of the specified player if set.", authMeBaseCommand); getEmailCommand.setCommandPermissions("authme.admin.getemail", CommandPermissions.DefaultPermission.OP_ONLY); getEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); // Register the setemail command - CommandDescription setEmailCommand = new CommandDescription( - new SetEmailCommand(), - new ArrayList() {{ - add("chgemail"); - add("chgmail"); - add("setemail"); - add("setmail"); - }}, - "Change player's email", - "Change the email address of the specified player.", - authMeBaseCommand); + CommandDescription setEmailCommand = new CommandDescription(new SetEmailCommand(), new ArrayList() { + + { + add("chgemail"); + add("chgmail"); + add("setemail"); + add("setmail"); + } + }, "Change player's email", "Change the email address of the specified player.", authMeBaseCommand); setEmailCommand.setCommandPermissions("authme.admin.chgemail", CommandPermissions.DefaultPermission.OP_ONLY); setEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); setEmailCommand.addArgument(new CommandArgumentDescription("email", "Player email", false)); // Register the getip command - CommandDescription getIpCommand = new CommandDescription( - new GetIpCommand(), - new ArrayList() {{ - add("getip"); - add("ip"); - }}, - "Get player's IP", - "Get the IP address of the specified online player.", - authMeBaseCommand); + CommandDescription getIpCommand = new CommandDescription(new GetIpCommand(), new ArrayList() { + + { + add("getip"); + add("ip"); + } + }, "Get player's IP", "Get the IP address of the specified online player.", authMeBaseCommand); getIpCommand.setCommandPermissions("authme.admin.getip", CommandPermissions.DefaultPermission.OP_ONLY); getIpCommand.addArgument(new CommandArgumentDescription("player", "Online player name", true)); // Register the spawn command - CommandDescription spawnCommand = new CommandDescription( - new SpawnCommand(), - new ArrayList() {{ - add("spawn"); - add("home"); - }}, - "Teleport to spawn", - "Teleport to the spawn.", - authMeBaseCommand); + CommandDescription spawnCommand = new CommandDescription(new SpawnCommand(), new ArrayList() { + + { + add("spawn"); + add("home"); + } + }, "Teleport to spawn", "Teleport to the spawn.", authMeBaseCommand); spawnCommand.setCommandPermissions("authme.admin.spawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the setspawn command - CommandDescription setSpawnCommand = new CommandDescription( - new SetSpawnCommand(), - new ArrayList() {{ - add("setspawn"); - add("chgspawn"); - }}, - "Change the spawn", - "Change the player's spawn to your current position.", - authMeBaseCommand); + CommandDescription setSpawnCommand = new CommandDescription(new SetSpawnCommand(), new ArrayList() { + + { + add("setspawn"); + add("chgspawn"); + } + }, "Change the spawn", "Change the player's spawn to your current position.", authMeBaseCommand); setSpawnCommand.setCommandPermissions("authme.admin.setspawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the firstspawn command - CommandDescription firstSpawnCommand = new CommandDescription( - new FirstSpawnCommand(), - new ArrayList() {{ - add("firstspawn"); - add("firsthome"); - }}, - "Teleport to first spawn", - "Teleport to the first spawn.", - authMeBaseCommand); + CommandDescription firstSpawnCommand = new CommandDescription(new FirstSpawnCommand(), new ArrayList() { + + { + add("firstspawn"); + add("firsthome"); + } + }, "Teleport to first spawn", "Teleport to the first spawn.", authMeBaseCommand); firstSpawnCommand.setCommandPermissions("authme.admin.firstspawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the setfirstspawn command - CommandDescription setFirstSpawnCommand = new CommandDescription( - new SetFirstSpawnCommand(), - new ArrayList() {{ - add("setfirstspawn"); - add("chgfirstspawn"); - }}, - "Change the first spawn", - "Change the first player's spawn to your current position.", - authMeBaseCommand); + CommandDescription setFirstSpawnCommand = new CommandDescription(new SetFirstSpawnCommand(), new ArrayList() { + + { + add("setfirstspawn"); + add("chgfirstspawn"); + } + }, "Change the first spawn", "Change the first player's spawn to your current position.", authMeBaseCommand); setFirstSpawnCommand.setCommandPermissions("authme.admin.setfirstspawn", CommandPermissions.DefaultPermission.OP_ONLY); // Register the purge command - CommandDescription purgeCommand = new CommandDescription( - new PurgeCommand(), - new ArrayList() {{ - add("purge"); - add("delete"); - }}, - "Purge old data", - "Purge old AuthMeReloaded data longer than the specified amount of days ago.", - authMeBaseCommand); + CommandDescription purgeCommand = new CommandDescription(new PurgeCommand(), new ArrayList() { + + { + add("purge"); + add("delete"); + } + }, "Purge old data", "Purge old AuthMeReloaded data longer than the specified amount of days ago.", authMeBaseCommand); purgeCommand.setCommandPermissions("authme.admin.purge", CommandPermissions.DefaultPermission.OP_ONLY); purgeCommand.addArgument(new CommandArgumentDescription("days", "Number of days", false)); // Register the purgelastposition command - CommandDescription purgeLastPositionCommand = new CommandDescription( - new PurgeLastPositionCommand(), - new ArrayList() {{ - add("resetpos"); - add("purgelastposition"); - add("purgelastpos"); - add("resetposition"); - add("resetlastposition"); - add("resetlastpos"); - }}, - "Purge player's last position", - "Purge the last know position of the specified player.", - authMeBaseCommand); + CommandDescription purgeLastPositionCommand = new CommandDescription(new PurgeLastPositionCommand(), new ArrayList() { + + { + add("resetpos"); + add("purgelastposition"); + add("purgelastpos"); + add("resetposition"); + add("resetlastposition"); + add("resetlastpos"); + } + }, "Purge player's last position", "Purge the last know position of the specified player.", authMeBaseCommand); purgeLastPositionCommand.setCommandPermissions("authme.admin.purgelastpos", CommandPermissions.DefaultPermission.OP_ONLY); purgeLastPositionCommand.addArgument(new CommandArgumentDescription("player", "Player name", true)); // Register the purgebannedplayers command - CommandDescription purgeBannedPlayersCommand = new CommandDescription( - new PurgeBannedPlayersCommand(), - new ArrayList() {{ - add("purgebannedplayers"); - add("purgebannedplayer"); - add("deletebannedplayers"); - add("deletebannedplayer"); - }}, - "Purge banned palyers data", - "Purge all AuthMeReloaded data for banned players.", - authMeBaseCommand); + CommandDescription purgeBannedPlayersCommand = new CommandDescription(new PurgeBannedPlayersCommand(), new ArrayList() { + + { + add("purgebannedplayers"); + add("purgebannedplayer"); + add("deletebannedplayers"); + add("deletebannedplayer"); + } + }, "Purge banned palyers data", "Purge all AuthMeReloaded data for banned players.", authMeBaseCommand); purgeBannedPlayersCommand.setCommandPermissions("authme.admin.purgebannedplayers", CommandPermissions.DefaultPermission.OP_ONLY); // Register the switchantibot command - CommandDescription switchAntiBotCommand = new CommandDescription( - new SwitchAntiBotCommand(), - new ArrayList() {{ - add("switchantibot"); - add("toggleantibot"); - add("antibot"); - }}, - "Switch AntiBot mode", - "Switch or toggle the AntiBot mode to the specified state.", - authMeBaseCommand); + CommandDescription switchAntiBotCommand = new CommandDescription(new SwitchAntiBotCommand(), new ArrayList() { + + { + add("switchantibot"); + add("toggleantibot"); + add("antibot"); + } + }, "Switch AntiBot mode", "Switch or toggle the AntiBot mode to the specified state.", authMeBaseCommand); switchAntiBotCommand.setCommandPermissions("authme.admin.switchantibot", CommandPermissions.DefaultPermission.OP_ONLY); switchAntiBotCommand.addArgument(new CommandArgumentDescription("mode", "ON / OFF", true)); -// // Register the resetname command -// CommandDescription resetNameCommand = new CommandDescription( -// new ResetNameCommand(), -// new ArrayList() {{ -// add("resetname"); -// add("resetnames"); -// }}, -// "Reset name", -// "Reset name", -// authMeCommand); -// resetNameCommand.setCommandPermissions("authme.admin.resetname", CommandPermissions.DefaultPermission.OP_ONLY); + // // Register the resetname command + // CommandDescription resetNameCommand = new CommandDescription( + // new ResetNameCommand(), + // new ArrayList() {{ + // add("resetname"); + // add("resetnames"); + // }}, + // "Reset name", + // "Reset name", + // authMeCommand); + // resetNameCommand.setCommandPermissions("authme.admin.resetname", + // CommandPermissions.DefaultPermission.OP_ONLY); // Register the reload command - CommandDescription reloadCommand = new CommandDescription( - new ReloadCommand(), - new ArrayList() {{ - add("reload"); - add("rld"); - }}, - "Reload plugin", - "Reload the AuthMeReloaded plugin.", - authMeBaseCommand); + CommandDescription reloadCommand = new CommandDescription(new ReloadCommand(), new ArrayList() { + + { + add("reload"); + add("rld"); + } + }, "Reload plugin", "Reload the AuthMeReloaded plugin.", authMeBaseCommand); reloadCommand.setCommandPermissions("authme.admin.reload", CommandPermissions.DefaultPermission.OP_ONLY); // Register the version command - CommandDescription versionCommand = new CommandDescription( - new VersionCommand(), - new ArrayList() {{ - add("version"); - add("ver"); - add("v"); - add("about"); - add("info"); - }}, - "Version info", - "Show detailed information about the installed AuthMeReloaded version, and shows the developers, contributors, license and other information.", - authMeBaseCommand); + CommandDescription versionCommand = new CommandDescription(new VersionCommand(), new ArrayList() { + + { + add("version"); + add("ver"); + add("v"); + add("about"); + add("info"); + } + }, "Version info", "Show detailed information about the installed AuthMeReloaded version, and shows the developers, contributors, license and other information.", authMeBaseCommand); versionCommand.setMaximumArguments(false); // Register the base Dungeon Maze command - CommandDescription loginBaseCommand = new CommandDescription( - new LoginCommand(), - new ArrayList() {{ - add("login"); - }}, - "Login command", - "Command to login using AuthMeReloaded.", null); + CommandDescription loginBaseCommand = new CommandDescription(new LoginCommand(), new ArrayList() { + + { + add("login"); + add("l"); + } + }, "Login command", "Command to login using AuthMeReloaded.", null); loginBaseCommand.setCommandPermissions("authme.login", CommandPermissions.DefaultPermission.ALLOWED); loginBaseCommand.addArgument(new CommandArgumentDescription("password", "Login password", false)); // Register the help command - CommandDescription loginHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded login commands.", - loginBaseCommand); + CommandDescription loginHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded login commands.", loginBaseCommand); loginHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); loginHelpCommand.setMaximumArguments(false); // Register the base logout command - CommandDescription logoutBaseCommand = new CommandDescription( - new LogoutCommand(), - new ArrayList() {{ - add("logout"); - }}, - "Logout command", - "Command to logout using AuthMeReloaded.", null); + CommandDescription logoutBaseCommand = new CommandDescription(new LogoutCommand(), new ArrayList() { + + { + add("logout"); + } + }, "Logout command", "Command to logout using AuthMeReloaded.", null); logoutBaseCommand.setCommandPermissions("authme.logout", CommandPermissions.DefaultPermission.ALLOWED); // Register the help command - CommandDescription logoutHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded logout commands.", - logoutBaseCommand); + CommandDescription logoutHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded logout commands.", logoutBaseCommand); logoutHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); logoutHelpCommand.setMaximumArguments(false); // Register the base register command - CommandDescription registerBaseCommand = new CommandDescription( - new fr.xephi.authme.command.executable.register.RegisterCommand(), - new ArrayList() {{ - add("register"); - add("reg"); - }}, - "Registration command", - "Command to register using AuthMeReloaded.", null); + CommandDescription registerBaseCommand = new CommandDescription(new fr.xephi.authme.command.executable.register.RegisterCommand(), new ArrayList() { + + { + add("register"); + add("reg"); + } + }, "Registration command", "Command to register using AuthMeReloaded.", null); registerBaseCommand.setCommandPermissions("authme.register", CommandPermissions.DefaultPermission.ALLOWED); registerBaseCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); registerBaseCommand.addArgument(new CommandArgumentDescription("verifyPassword", "Verify password", false)); registerBaseCommand.setMaximumArguments(false); // Register the help command - CommandDescription registerHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded register commands.", - registerBaseCommand); + CommandDescription registerHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded register commands.", registerBaseCommand); registerHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); registerHelpCommand.setMaximumArguments(false); // Register the base unregister command - CommandDescription unregisterBaseCommand = new CommandDescription( - new fr.xephi.authme.command.executable.unregister.UnregisterCommand(), - new ArrayList() {{ - add("unregister"); - add("unreg"); - }}, - "Unregistration command", - "Command to unregister using AuthMeReloaded.", null); + CommandDescription unregisterBaseCommand = new CommandDescription(new fr.xephi.authme.command.executable.unregister.UnregisterCommand(), new ArrayList() { + + { + add("unregister"); + add("unreg"); + } + }, "Unregistration command", "Command to unregister using AuthMeReloaded.", null); unregisterBaseCommand.setCommandPermissions("authme.unregister", CommandPermissions.DefaultPermission.ALLOWED); unregisterBaseCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); // Register the help command - CommandDescription unregisterHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded unregister commands.", - unregisterBaseCommand); + CommandDescription unregisterHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded unregister commands.", unregisterBaseCommand); unregisterHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); unregisterHelpCommand.setMaximumArguments(false); // Register the base changepassword command - CommandDescription changePasswordBaseCommand = new CommandDescription( - new fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand(), - new ArrayList() {{ - add("changepassword"); - add("changepass"); - }}, - "Change password command", - "Command to change your password using AuthMeReloaded.", null); + CommandDescription changePasswordBaseCommand = new CommandDescription(new fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand(), new ArrayList() { + + { + add("changepassword"); + add("changepass"); + } + }, "Change password command", "Command to change your password using AuthMeReloaded.", null); changePasswordBaseCommand.setCommandPermissions("authme.changepassword", CommandPermissions.DefaultPermission.ALLOWED); changePasswordBaseCommand.addArgument(new CommandArgumentDescription("password", "Password", false)); changePasswordBaseCommand.addArgument(new CommandArgumentDescription("verifyPassword", "Verify password", false)); changePasswordBaseCommand.setMaximumArguments(false); // Register the help command - CommandDescription changePasswordHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded change password commands.", - changePasswordBaseCommand); + CommandDescription changePasswordHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded change password commands.", changePasswordBaseCommand); changePasswordHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); changePasswordHelpCommand.setMaximumArguments(false); // Register the base Dungeon Maze command - CommandDescription emailBaseCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("email"); - add("mail"); - }}, - "E-mail command", - "The AuthMe Reloaded E-mail command. The root for all E-mail commands.", null); + CommandDescription emailBaseCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("email"); + add("mail"); + } + }, "E-mail command", "The AuthMe Reloaded E-mail command. The root for all E-mail commands.", null); // Register the help command - CommandDescription emailHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded help commands.", - emailBaseCommand); + CommandDescription emailHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded help commands.", emailBaseCommand); emailHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); emailHelpCommand.setMaximumArguments(false); // Register the add command - CommandDescription addEmailCommand = new CommandDescription( - new AddEmailCommand(), - new ArrayList() {{ - add("add"); - add("addemail"); - add("addmail"); - }}, - "Add E-mail", - "Add an new E-Mail address to your account.", - emailBaseCommand); + CommandDescription addEmailCommand = new CommandDescription(new AddEmailCommand(), new ArrayList() { + + { + add("add"); + add("addemail"); + add("addmail"); + } + }, "Add E-mail", "Add an new E-Mail address to your account.", emailBaseCommand); addEmailCommand.setCommandPermissions("authme.email.add", CommandPermissions.DefaultPermission.ALLOWED); addEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false)); addEmailCommand.addArgument(new CommandArgumentDescription("verifyEmail", "Email address verification", false)); // Register the change command - CommandDescription changeEmailCommand = new CommandDescription( - new ChangeEmailCommand(), - new ArrayList() {{ - add("change"); - add("changeemail"); - add("changemail"); - }}, - "Change E-mail", - "Change an E-Mail address of your account.", - emailBaseCommand); + CommandDescription changeEmailCommand = new CommandDescription(new ChangeEmailCommand(), new ArrayList() { + + { + add("change"); + add("changeemail"); + add("changemail"); + } + }, "Change E-mail", "Change an E-Mail address of your account.", emailBaseCommand); changeEmailCommand.setCommandPermissions("authme.email.change", CommandPermissions.DefaultPermission.ALLOWED); changeEmailCommand.addArgument(new CommandArgumentDescription("oldEmail", "Old email address", false)); changeEmailCommand.addArgument(new CommandArgumentDescription("newEmail", "New email address", false)); // Register the recover command - CommandDescription recoverEmailCommand = new CommandDescription( - new RecoverEmailCommand(), - new ArrayList() {{ - add("recover"); - add("recovery"); - add("recoveremail"); - add("recovermail"); - }}, - "Recover using E-mail", - "Recover your account using an E-mail address.", - emailBaseCommand); + CommandDescription recoverEmailCommand = new CommandDescription(new RecoverEmailCommand(), new ArrayList() { + + { + add("recover"); + add("recovery"); + add("recoveremail"); + add("recovermail"); + } + }, "Recover using E-mail", "Recover your account using an E-mail address.", emailBaseCommand); recoverEmailCommand.setCommandPermissions("authme.email.recover", CommandPermissions.DefaultPermission.ALLOWED); recoverEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false)); // Register the base captcha command - CommandDescription captchaBaseCommand = new CommandDescription( - new CaptchaCommand(), - new ArrayList() {{ - add("captcha"); - add("capt"); - }}, - "Captcha command", - "Captcha command for AuthMeReloaded.", null); + CommandDescription captchaBaseCommand = new CommandDescription(new CaptchaCommand(), new ArrayList() { + + { + add("captcha"); + add("capt"); + } + }, "Captcha command", "Captcha command for AuthMeReloaded.", null); captchaBaseCommand.setCommandPermissions("authme.captcha", CommandPermissions.DefaultPermission.ALLOWED); captchaBaseCommand.addArgument(new CommandArgumentDescription("captcha", "The captcha", false)); captchaBaseCommand.setMaximumArguments(false); // Register the help command - CommandDescription captchaHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded change captcha commands.", - captchaBaseCommand); + CommandDescription captchaHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded change captcha commands.", captchaBaseCommand); captchaHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); captchaHelpCommand.setMaximumArguments(false); // Register the base converter command - CommandDescription converterBaseCommand = new CommandDescription( - new ConverterCommand(), - new ArrayList() {{ - add("converter"); - add("convert"); - add("conv"); - }}, - "Convert command", - "Convert command for AuthMeReloaded.", null); + CommandDescription converterBaseCommand = new CommandDescription(new ConverterCommand(), new ArrayList() { + + { + add("converter"); + add("convert"); + add("conv"); + } + }, "Convert command", "Convert command for AuthMeReloaded.", null); converterBaseCommand.setCommandPermissions("authme.converter", CommandPermissions.DefaultPermission.OP_ONLY); converterBaseCommand.addArgument(new CommandArgumentDescription("job", "Conversion job: flattosql / flattosqlite /| xauth / crazylogin / rakamak / royalauth / vauth / sqltoflat", false)); converterBaseCommand.setMaximumArguments(false); // Register the help command - CommandDescription converterHelpCommand = new CommandDescription( - new HelpCommand(), - new ArrayList() {{ - add("help"); - add("hlp"); - add("h"); - add("sos"); - add("?"); - }}, - "View help", - "View detailed help pages about AuthMeReloaded change captcha commands.", - converterBaseCommand); + CommandDescription converterHelpCommand = new CommandDescription(new HelpCommand(), new ArrayList() { + + { + add("help"); + add("hlp"); + add("h"); + add("sos"); + add("?"); + } + }, "View help", "View detailed help pages about AuthMeReloaded change captcha commands.", converterBaseCommand); converterHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true)); converterHelpCommand.setMaximumArguments(false); @@ -657,19 +589,21 @@ public class CommandManager { /** * Find the best suitable command for the specified reference. * - * @param queryReference The query reference to find a command for. + * @param queryReference + * The query reference to find a command for. * * @return The command found, or null. */ public FoundCommandResult findCommand(CommandParts queryReference) { // Make sure the command reference is valid - if(queryReference.getCount() <= 0) + if (queryReference.getCount() <= 0) return null; // Get the base command description - for(CommandDescription commandDescription : this.commandDescriptions) { - // Check whether there's a command description available for the current command - if(!commandDescription.isSuitableLabel(queryReference)) + for (CommandDescription commandDescription : this.commandDescriptions) { + // Check whether there's a command description available for the + // current command + if (!commandDescription.isSuitableLabel(queryReference)) continue; // Find the command reference, return the result