Add 'l' alias to /login command

This commit is contained in:
Xephi59 2015-11-08 14:50:04 +01:00
parent 7b5a17d8f4
commit 54c56461f1

View File

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