mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-30 22:23:54 +01:00
Finish change to CommandBuilder
This commit is contained in:
parent
979c4b5a85
commit
f40d75e4aa
@ -1,5 +1,6 @@
|
|||||||
package fr.xephi.authme.command;
|
package fr.xephi.authme.command;
|
||||||
|
|
||||||
|
import fr.xephi.authme.command.CommandPermissions.DefaultPermission;
|
||||||
import fr.xephi.authme.command.executable.HelpCommand;
|
import fr.xephi.authme.command.executable.HelpCommand;
|
||||||
import fr.xephi.authme.command.executable.authme.AccountsCommand;
|
import fr.xephi.authme.command.executable.authme.AccountsCommand;
|
||||||
import fr.xephi.authme.command.executable.authme.AuthMeCommand;
|
import fr.xephi.authme.command.executable.authme.AuthMeCommand;
|
||||||
@ -250,26 +251,25 @@ public final class CommandInitializer {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Register the purgebannedplayers command
|
// Register the purgebannedplayers command
|
||||||
CommandDescription purgeBannedPlayersCommand = new CommandDescription(new PurgeBannedPlayersCommand(), new ArrayList<String>() {
|
CommandDescription purgeBannedPlayersCommand = CommandDescription.builder()
|
||||||
{
|
.executableCommand(new PurgeBannedPlayersCommand())
|
||||||
add("purgebannedplayers");
|
.parent(AUTHME_BASE)
|
||||||
add("purgebannedplayer");
|
.labels("purgebannedplayers", "purgebannedplayer", "deletebannedplayers", "deletebannedplayer")
|
||||||
add("deletebannedplayers");
|
.description("Purge banned players data")
|
||||||
add("deletebannedplayer");
|
.detailedDescription("Purge all AuthMeReloaded data for banned players.")
|
||||||
}
|
.permissions(OP_ONLY, AdminPermission.PURGE_BANNED_PLAYERS)
|
||||||
}, "Purge banned palyers data", "Purge all AuthMeReloaded data for banned players.", AUTHME_BASE);
|
.build();
|
||||||
purgeBannedPlayersCommand.setCommandPermissions(AdminPermission.PURGE_BANNED_PLAYERS, OP_ONLY);
|
|
||||||
|
|
||||||
// Register the switchantibot command
|
// Register the switchantibot command
|
||||||
CommandDescription switchAntiBotCommand = new CommandDescription(new SwitchAntiBotCommand(), new ArrayList<String>() {
|
CommandDescription switchAntiBotCommand = CommandDescription.builder()
|
||||||
{
|
.executableCommand(new SwitchAntiBotCommand())
|
||||||
add("switchantibot");
|
.parent(AUTHME_BASE)
|
||||||
add("toggleantibot");
|
.labels("switchantibot", "toggleantibot", "antibot")
|
||||||
add("antibot");
|
.description("Switch AntiBot mode")
|
||||||
}
|
.detailedDescription("Switch or toggle the AntiBot mode to the specified state.")
|
||||||
}, "Switch AntiBot mode", "Switch or toggle the AntiBot mode to the specified state.", AUTHME_BASE);
|
.permissions(OP_ONLY, AdminPermission.SWITCH_ANTIBOT)
|
||||||
switchAntiBotCommand.setCommandPermissions(AdminPermission.SWITCH_ANTIBOT, OP_ONLY);
|
.withArgument("mode", "ON / OFF", true)
|
||||||
switchAntiBotCommand.addArgument(new CommandArgumentDescription("mode", "ON / OFF", true));
|
.build();
|
||||||
|
|
||||||
// // Register the resetname command
|
// // Register the resetname command
|
||||||
// CommandDescription resetNameCommand = new CommandDescription(
|
// CommandDescription resetNameCommand = new CommandDescription(
|
||||||
@ -285,13 +285,14 @@ public final class CommandInitializer {
|
|||||||
// CommandPermissions.DefaultPermission.OP_ONLY);
|
// CommandPermissions.DefaultPermission.OP_ONLY);
|
||||||
|
|
||||||
// Register the reload command
|
// Register the reload command
|
||||||
CommandDescription reloadCommand = new CommandDescription(new ReloadCommand(), new ArrayList<String>() {
|
CommandDescription reloadCommand = CommandDescription.builder()
|
||||||
{
|
.executableCommand(new PurgeLastPositionCommand())
|
||||||
add("reload");
|
.parent(AUTHME_BASE)
|
||||||
add("rld");
|
.labels("reload", "reload")
|
||||||
}
|
.description("Reload plugin")
|
||||||
}, "Reload plugin", "Reload the AuthMeReloaded plugin.", AUTHME_BASE);
|
.detailedDescription("Reload the AutheMeReloaded plugin.")
|
||||||
reloadCommand.setCommandPermissions(AdminPermission.RELOAD, OP_ONLY);
|
.permissions(OP_ONLY, AdminPermission.RELOAD)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the version command
|
// Register the version command
|
||||||
CommandDescription.builder()
|
CommandDescription.builder()
|
||||||
@ -315,22 +316,36 @@ public final class CommandInitializer {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Register the help command
|
// Register the help command
|
||||||
CommandDescription loginHelpCommand = new CommandDescription(helpCommandExecutable, helpCommandLabels,
|
CommandDescription loginHelpCommand = CommandDescription.builder()
|
||||||
"View help", "View detailed help pages about AuthMeReloaded login commands.", LOGIN_BASE);
|
.executableCommand(helpCommandExecutable)
|
||||||
loginHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true));
|
.parent(LOGIN_BASE)
|
||||||
|
.labels(helpCommandLabels)
|
||||||
|
.description("View Help")
|
||||||
|
.detailedDescription("View detailed help pages about AuthMeReloaded login commands.")
|
||||||
|
.permissions(ALLOWED)
|
||||||
|
.withArgument("query", "The command or query to view help for.", true)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the base logout command
|
// Register the base logout command
|
||||||
CommandDescription LOGOUT_BASE = new CommandDescription(new LogoutCommand(), new ArrayList<String>() {
|
CommandDescription LOGOUT_BASE = CommandDescription.builder()
|
||||||
{
|
.executableCommand(new LogoutCommand())
|
||||||
add("logout");
|
.parent(null)
|
||||||
}
|
.labels("logout")
|
||||||
}, "Logout command", "Command to logout using AuthMeReloaded.", null);
|
.description("Logout command")
|
||||||
LOGOUT_BASE.setCommandPermissions(PlayerPermission.LOGOUT, ALLOWED);
|
.detailedDescription("Command to logout using AuthMeReloaded.")
|
||||||
|
.permissions(ALLOWED, PlayerPermission.LOGOUT)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the help command
|
// Register the help command
|
||||||
CommandDescription logoutHelpCommand = new CommandDescription(helpCommandExecutable, helpCommandLabels,
|
CommandDescription logoutHelpCommand = CommandDescription.builder()
|
||||||
"View help", "View detailed help pages about AuthMeReloaded logout commands.", LOGOUT_BASE);
|
.executableCommand(helpCommandExecutable)
|
||||||
logoutHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true));
|
.parent(LOGOUT_BASE)
|
||||||
|
.labels(helpCommandLabels)
|
||||||
|
.description("View help")
|
||||||
|
.detailedDescription("View detailed help pages about AuthMeReloaded logout commands.")
|
||||||
|
.permissions(ALLOWED)
|
||||||
|
.withArgument("query", "The command or query to view help for.", true)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the base register command
|
// Register the base register command
|
||||||
final CommandDescription REGISTER_BASE = CommandDescription.builder()
|
final CommandDescription REGISTER_BASE = CommandDescription.builder()
|
||||||
@ -345,120 +360,161 @@ public final class CommandInitializer {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Register the help command
|
// Register the help command
|
||||||
CommandDescription registerHelpCommand = new CommandDescription(helpCommandExecutable, helpCommandLabels,
|
CommandDescription registerHelpCommand = CommandDescription.builder()
|
||||||
"View help", "View detailed help pages about AuthMeReloaded register commands.", REGISTER_BASE);
|
.executableCommand(helpCommandExecutable)
|
||||||
registerHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true));
|
.parent(REGISTER_BASE)
|
||||||
|
.labels(helpCommandLabels)
|
||||||
|
.description("View help")
|
||||||
|
.detailedDescription("View detailed help pages about AuthMeReloaded register commands.")
|
||||||
|
.permissions(ALLOWED)
|
||||||
|
.withArgument("query", "The command or query to view help for.", true)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the base unregister command
|
// Register the base unregister command
|
||||||
CommandDescription UNREGISTER_BASE = new CommandDescription(new UnregisterCommand(), new ArrayList<String>() {
|
CommandDescription UNREGISTER_BASE = CommandDescription.builder()
|
||||||
{
|
.executableCommand(new UnregisterCommand())
|
||||||
add("unregister");
|
.parent(null)
|
||||||
add("unreg");
|
.labels("unreg", "unregister")
|
||||||
}
|
.description("Unregistration Command")
|
||||||
}, "Unregistration command", "Command to unregister using AuthMeReloaded.", null);
|
.detailedDescription("Command to unregister using AuthMeReloaded.")
|
||||||
UNREGISTER_BASE.setCommandPermissions(PlayerPermission.UNREGISTER, ALLOWED);
|
.permissions(ALLOWED, PlayerPermission.UNREGISTER)
|
||||||
UNREGISTER_BASE.addArgument(new CommandArgumentDescription("password", "Password", false));
|
.withArgument("password", "Password", false)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the help command
|
// Register the help command
|
||||||
CommandDescription unregisterHelpCommand = new CommandDescription(helpCommandExecutable, helpCommandLabels, "View help", "View detailed help pages about AuthMeReloaded unregister commands.", UNREGISTER_BASE);
|
CommandDescription unregisterHelpCommand = CommandDescription.builder()
|
||||||
unregisterHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true));
|
.executableCommand(helpCommandExecutable)
|
||||||
|
.parent(UNREGISTER_BASE)
|
||||||
|
.labels(helpCommandLabels)
|
||||||
|
.description("View help")
|
||||||
|
.detailedDescription("View detailed help pages about AuthMeReloaded unregister commands.")
|
||||||
|
.permissions(ALLOWED)
|
||||||
|
.withArgument("query", "The command or query to view help for.", true)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the base changepassword command
|
// Register the base changepassword command
|
||||||
final CommandDescription CHANGE_PASSWORD_BASE = new CommandDescription(
|
final CommandDescription CHANGE_PASSWORD_BASE = CommandDescription.builder()
|
||||||
new ChangePasswordCommand(), new ArrayList<String>() {
|
.executableCommand(new ChangePasswordCommand())
|
||||||
{
|
.parent(null)
|
||||||
add("changepassword");
|
.labels("changepassword", "changepass", "cp")
|
||||||
add("changepass");
|
.description("Change password Command")
|
||||||
}
|
.detailedDescription("Command to change your password using AuthMeReloaded.")
|
||||||
}, "Change password command", "Command to change your password using AuthMeReloaded.", null);
|
.permissions(ALLOWED, PlayerPermission.CHANGE_PASSWORD)
|
||||||
CHANGE_PASSWORD_BASE.setCommandPermissions(PlayerPermission.CHANGE_PASSWORD, ALLOWED);
|
.withArgument("password", "Password", false)
|
||||||
CHANGE_PASSWORD_BASE.addArgument(new CommandArgumentDescription("password", "Password", false));
|
.withArgument("verifyPassword", "Verify password.", false)
|
||||||
CHANGE_PASSWORD_BASE.addArgument(new CommandArgumentDescription("verifyPassword", "Verify password", false));
|
.build();
|
||||||
|
|
||||||
// Register the help command
|
// Register the help command
|
||||||
CommandDescription changePasswordHelpCommand = new CommandDescription(helpCommandExecutable, helpCommandLabels,
|
CommandDescription changePasswordHelpCommand = CommandDescription.builder()
|
||||||
"View help", "View detailed help pages about AuthMeReloaded change password commands.", CHANGE_PASSWORD_BASE);
|
.executableCommand(helpCommandExecutable)
|
||||||
changePasswordHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true));
|
.parent(CHANGE_PASSWORD_BASE)
|
||||||
|
.labels(helpCommandLabels)
|
||||||
|
.description("View help")
|
||||||
|
.detailedDescription("View detailed help pages about AuthMeReloaded changepassword commands.")
|
||||||
|
.permissions(ALLOWED)
|
||||||
|
.withArgument("query", "The command or query to view help for.", true)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the base Dungeon Maze command
|
// Register the base Email command
|
||||||
CommandDescription EMAIL_BASE = new CommandDescription(helpCommandExecutable, new ArrayList<String>() {
|
CommandDescription EMAIL_BASE = CommandDescription.builder()
|
||||||
{
|
.executableCommand(helpCommandExecutable)
|
||||||
add("email");
|
.parent(null)
|
||||||
add("mail");
|
.labels("email", "mail")
|
||||||
}
|
.description("Email command")
|
||||||
}, "E-mail command", "The AuthMe Reloaded E-mail command. The root for all E-mail commands.", null);
|
.detailedDescription("The AuthMeReloaded Email command base.")
|
||||||
|
.permissions(ALLOWED)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the help command
|
// Register the help command
|
||||||
CommandDescription emailHelpCommand = new CommandDescription(helpCommandExecutable, helpCommandLabels,
|
CommandDescription emailHelpCommand = CommandDescription.builder()
|
||||||
"View help", "View detailed help pages about AuthMeReloaded help commands.", EMAIL_BASE);
|
.executableCommand(helpCommandExecutable)
|
||||||
emailHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true));
|
.parent(EMAIL_BASE)
|
||||||
|
.labels(helpCommandLabels)
|
||||||
|
.description("View help")
|
||||||
|
.detailedDescription("View detailed help pages about AuthMeReloaded email commands.")
|
||||||
|
.permissions(ALLOWED)
|
||||||
|
.withArgument("query", "The command or query to view help for.", true)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the add command
|
// Register the add command
|
||||||
CommandDescription addEmailCommand = new CommandDescription(new AddEmailCommand(), new ArrayList<String>() {
|
CommandDescription addEmailCommand = CommandDescription.builder()
|
||||||
{
|
.executableCommand(new AddEmailCommand())
|
||||||
add("add");
|
.parent(EMAIL_BASE)
|
||||||
add("addemail");
|
.labels("add", "addemail", "addmail")
|
||||||
add("addmail");
|
.description("Add Email")
|
||||||
}
|
.detailedDescription("Add a new Email address to your account.")
|
||||||
}, "Add E-mail", "Add an new E-Mail address to your account.", EMAIL_BASE);
|
.permissions(ALLOWED, PlayerPermission.ADD_EMAIL)
|
||||||
addEmailCommand.setCommandPermissions(PlayerPermission.ADD_EMAIL, ALLOWED);
|
.withArgument("email", "Email address", false)
|
||||||
addEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false));
|
.withArgument("verifyEmail", "Email address verification", false)
|
||||||
addEmailCommand.addArgument(new CommandArgumentDescription("verifyEmail", "Email address verification", false));
|
.build();
|
||||||
|
|
||||||
// Register the change command
|
// Register the change command
|
||||||
CommandDescription changeEmailCommand = new CommandDescription(new ChangeEmailCommand(), new ArrayList<String>() {
|
CommandDescription changeEmailCommand = CommandDescription.builder()
|
||||||
{
|
.executableCommand(new ChangeEmailCommand())
|
||||||
add("change");
|
.parent(EMAIL_BASE)
|
||||||
add("changeemail");
|
.labels("change", "changeemail", "changemail")
|
||||||
add("changemail");
|
.description("Change Email")
|
||||||
}
|
.detailedDescription("Change an Email address of your account.")
|
||||||
}, "Change E-mail", "Change an E-Mail address of your account.", EMAIL_BASE);
|
.permissions(ALLOWED, PlayerPermission.CHANGE_EMAIL)
|
||||||
changeEmailCommand.setCommandPermissions(PlayerPermission.CHANGE_EMAIL, ALLOWED);
|
.withArgument("oldEmail", "Old email address", false)
|
||||||
changeEmailCommand.addArgument(new CommandArgumentDescription("oldEmail", "Old email address", false));
|
.withArgument("newEmail", "New email address", false)
|
||||||
changeEmailCommand.addArgument(new CommandArgumentDescription("newEmail", "New email address", false));
|
.build();
|
||||||
|
|
||||||
|
|
||||||
// Register the recover command
|
// Register the recover command
|
||||||
CommandDescription recoverEmailCommand = new CommandDescription(new RecoverEmailCommand(), new ArrayList<String>() {
|
CommandDescription recoverEmailCommand = CommandDescription.builder()
|
||||||
{
|
.executableCommand(new RecoverEmailCommand())
|
||||||
add("recover");
|
.parent(EMAIL_BASE)
|
||||||
add("recovery");
|
.labels("recover", "recovery", "recoveremail", "recovermail")
|
||||||
add("recoveremail");
|
.description("Recover password using Email")
|
||||||
add("recovermail");
|
.detailedDescription("Recover your account using an Email address by sending a mail containing a new password.")
|
||||||
}
|
.permissions(ALLOWED, PlayerPermission.RECOVER_EMAIL)
|
||||||
}, "Recover using E-mail", "Recover your account using an E-mail address.", EMAIL_BASE);
|
.withArgument("email", "Email address", false)
|
||||||
recoverEmailCommand.setCommandPermissions(PlayerPermission.RECOVER_EMAIL, ALLOWED);
|
.build();
|
||||||
recoverEmailCommand.addArgument(new CommandArgumentDescription("email", "Email address", false));
|
|
||||||
|
|
||||||
// Register the base captcha command
|
// Register the base captcha command
|
||||||
CommandDescription CAPTCHA_BASE = new CommandDescription(new CaptchaCommand(), new ArrayList<String>() {
|
CommandDescription CAPTCHA_BASE = CommandDescription.builder()
|
||||||
{
|
.executableCommand(new CaptchaCommand())
|
||||||
add("captcha");
|
.parent(null)
|
||||||
add("capt");
|
.labels("captcha", "capt")
|
||||||
}
|
.description("Captcha Command")
|
||||||
}, "Captcha command", "Captcha command for AuthMeReloaded.", null);
|
.detailedDescription("Captcha command for AuthMeRelaoded.")
|
||||||
CAPTCHA_BASE.setCommandPermissions(PlayerPermission.CAPTCHA, ALLOWED);
|
.permissions(ALLOWED, PlayerPermission.CAPTCHA)
|
||||||
CAPTCHA_BASE.addArgument(new CommandArgumentDescription("captcha", "The captcha", false));
|
.withArgument("captcha", "The Captcha", false)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the help command
|
// Register the help command
|
||||||
CommandDescription captchaHelpCommand = new CommandDescription(helpCommandExecutable, helpCommandLabels,
|
CommandDescription captchaHelpCommand = CommandDescription.builder()
|
||||||
"View help", "View detailed help pages about AuthMeReloaded change captcha commands.", CAPTCHA_BASE);
|
.executableCommand(helpCommandExecutable)
|
||||||
captchaHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true));
|
.parent(CAPTCHA_BASE)
|
||||||
|
.labels(helpCommandLabels)
|
||||||
|
.description("View help")
|
||||||
|
.detailedDescription("View detailed help pages about AuthMeReloaded captcha commands.")
|
||||||
|
.permissions(ALLOWED)
|
||||||
|
.withArgument("query", "The command or query to view help for.", true)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Register the base converter command
|
// Register the base converter command
|
||||||
CommandDescription CONVERTER_BASE = new CommandDescription(new ConverterCommand(), new ArrayList<String>() {
|
CommandDescription CONVERTER_BASE = CommandDescription.builder()
|
||||||
{
|
.executableCommand(new ConverterCommand())
|
||||||
add("converter");
|
.parent(null)
|
||||||
add("convert");
|
.labels("converter", "convert", "conv")
|
||||||
add("conv");
|
.description("Converter Command")
|
||||||
}
|
.detailedDescription("Converter command for AuthMeRelaoded.")
|
||||||
}, "Convert command", "Convert command for AuthMeReloaded.", null);
|
.permissions(OP_ONLY, AdminPermission.CONVERTER)
|
||||||
CONVERTER_BASE.setCommandPermissions(AdminPermission.CONVERTER, OP_ONLY);
|
.withArgument("job", "Conversion job: flattosql / flattosqlite /| xauth / crazylogin / rakamak / royalauth / vauth / sqltoflat", false)
|
||||||
CONVERTER_BASE.addArgument(new CommandArgumentDescription("job", "Conversion job: flattosql / flattosqlite /| xauth / crazylogin / rakamak / royalauth / vauth / sqltoflat", false));
|
.build();
|
||||||
|
|
||||||
// Register the help command
|
// Register the help command
|
||||||
CommandDescription converterHelpCommand = new CommandDescription(helpCommandExecutable, helpCommandLabels,
|
CommandDescription converterHelpCommand = CommandDescription.builder()
|
||||||
"View help", "View detailed help pages about AuthMeReloaded change captcha commands.", CONVERTER_BASE);
|
.executableCommand(helpCommandExecutable)
|
||||||
converterHelpCommand.addArgument(new CommandArgumentDescription("query", "The command or query to view help for.", true));
|
.parent(CONVERTER_BASE)
|
||||||
|
.labels(helpCommandLabels)
|
||||||
|
.description("View help")
|
||||||
|
.detailedDescription("View detailed help pages about AuthMeReloaded converter commands.")
|
||||||
|
.permissions(OP_ONLY)
|
||||||
|
.withArgument("query", "The command or query to view help for.", true)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Add the base commands to the commands array
|
// Add the base commands to the commands array
|
||||||
baseCommands = new HashSet<>(Arrays.asList(
|
baseCommands = new HashSet<>(Arrays.asList(
|
||||||
|
Loading…
Reference in New Issue
Block a user