CommandInitializer - consistent indent and setter order

This commit is contained in:
ljacqu 2015-12-13 10:49:15 +01:00
parent c48c56f08c
commit 3e928cddf0

View File

@ -36,9 +36,10 @@ import fr.xephi.authme.permission.AdminPermission;
import fr.xephi.authme.permission.PlayerPermission; import fr.xephi.authme.permission.PlayerPermission;
import fr.xephi.authme.util.Wrapper; import fr.xephi.authme.util.Wrapper;
import java.util.*; import java.util.Arrays;
import java.util.List;
import java.util.Set;
import static com.google.common.collect.Sets.newHashSet;
import static fr.xephi.authme.permission.DefaultPermission.ALLOWED; import static fr.xephi.authme.permission.DefaultPermission.ALLOWED;
import static fr.xephi.authme.permission.DefaultPermission.OP_ONLY; import static fr.xephi.authme.permission.DefaultPermission.OP_ONLY;
@ -158,127 +159,127 @@ public final class CommandInitializer {
.labels("getemail", "getmail", "email", "mail") .labels("getemail", "getmail", "email", "mail")
.description("Display player's email") .description("Display player's email")
.detailedDescription("Display the email address of the specified player if set.") .detailedDescription("Display the email address of the specified player if set.")
.permissions(OP_ONLY, AdminPermission.GET_EMAIL)
.withArgument("player", "Player name", true) .withArgument("player", "Player name", true)
.permissions(OP_ONLY, AdminPermission.GET_EMAIL)
.executableCommand(new GetEmailCommand()) .executableCommand(new GetEmailCommand())
.build(); .build();
// Register the setemail command // Register the setemail command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new SetEmailCommand())
.parent(AUTHME_BASE) .parent(AUTHME_BASE)
.labels("chgemail", "chgmail", "setemail", "setmail") .labels("chgemail", "chgmail", "setemail", "setmail")
.description("Change player's email") .description("Change player's email")
.detailedDescription("Change the email address of the specified player.") .detailedDescription("Change the email address of the specified player.")
.permissions(OP_ONLY, AdminPermission.CHANGE_EMAIL)
.withArgument("player", "Player name", false) .withArgument("player", "Player name", false)
.withArgument("email", "Player email", false) .withArgument("email", "Player email", false)
.permissions(OP_ONLY, AdminPermission.CHANGE_EMAIL)
.executableCommand(new SetEmailCommand())
.build(); .build();
// Register the getip command // Register the getip command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new GetIpCommand())
.parent(AUTHME_BASE) .parent(AUTHME_BASE)
.labels("getip", "ip") .labels("getip", "ip")
.description("Get player's IP") .description("Get player's IP")
.detailedDescription("Get the IP address of the specified online player.") .detailedDescription("Get the IP address of the specified online player.")
.permissions(OP_ONLY, AdminPermission.GET_IP)
.withArgument("player", "Player Name", false) .withArgument("player", "Player Name", false)
.permissions(OP_ONLY, AdminPermission.GET_IP)
.executableCommand(new GetIpCommand())
.build(); .build();
// Register the spawn command // Register the spawn command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new SpawnCommand())
.parent(AUTHME_BASE) .parent(AUTHME_BASE)
.labels("spawn", "home") .labels("spawn", "home")
.description("Teleport to spawn") .description("Teleport to spawn")
.detailedDescription("Teleport to the spawn.") .detailedDescription("Teleport to the spawn.")
.permissions(OP_ONLY, AdminPermission.SPAWN)
.withArgument("player", "Player Name", false) .withArgument("player", "Player Name", false)
.permissions(OP_ONLY, AdminPermission.SPAWN)
.executableCommand(new SpawnCommand())
.build(); .build();
// Register the setspawn command // Register the setspawn command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new SetSpawnCommand())
.parent(AUTHME_BASE) .parent(AUTHME_BASE)
.labels("setspawn", "chgspawn") .labels("setspawn", "chgspawn")
.description("Change the spawn") .description("Change the spawn")
.detailedDescription("Change the player's spawn to your current position.") .detailedDescription("Change the player's spawn to your current position.")
.permissions(OP_ONLY, AdminPermission.SET_SPAWN) .permissions(OP_ONLY, AdminPermission.SET_SPAWN)
.executableCommand(new SetSpawnCommand())
.build(); .build();
// Register the firstspawn command // Register the firstspawn command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new FirstSpawnCommand())
.parent(AUTHME_BASE) .parent(AUTHME_BASE)
.labels("firstspawn", "firsthome") .labels("firstspawn", "firsthome")
.description("Teleport to first spawn") .description("Teleport to first spawn")
.detailedDescription("Teleport to the first spawn.") .detailedDescription("Teleport to the first spawn.")
.permissions(OP_ONLY, AdminPermission.FIRST_SPAWN) .permissions(OP_ONLY, AdminPermission.FIRST_SPAWN)
.executableCommand(new FirstSpawnCommand())
.build(); .build();
// Register the setfirstspawn command // Register the setfirstspawn command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new SetFirstSpawnCommand())
.parent(AUTHME_BASE) .parent(AUTHME_BASE)
.labels("setfirstspawn", "chgfirstspawn") .labels("setfirstspawn", "chgfirstspawn")
.description("Change the first spawn") .description("Change the first spawn")
.detailedDescription("Change the first player's spawn to your current position.") .detailedDescription("Change the first player's spawn to your current position.")
.permissions(OP_ONLY, AdminPermission.SET_FIRST_SPAWN) .permissions(OP_ONLY, AdminPermission.SET_FIRST_SPAWN)
.executableCommand(new SetFirstSpawnCommand())
.build(); .build();
// Register the purge command // Register the purge command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new PurgeCommand())
.parent(AUTHME_BASE) .parent(AUTHME_BASE)
.labels("purge", "delete") .labels("purge", "delete")
.description("Purge old data") .description("Purge old data")
.detailedDescription("Purge old AuthMeReloaded data longer than the specified amount of days ago.") .detailedDescription("Purge old AuthMeReloaded data longer than the specified amount of days ago.")
.permissions(OP_ONLY, AdminPermission.PURGE)
.withArgument("days", "Number of days", false) .withArgument("days", "Number of days", false)
.permissions(OP_ONLY, AdminPermission.PURGE)
.executableCommand(new PurgeCommand())
.build(); .build();
// Register the purgelastposition command // Register the purgelastposition command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new PurgeLastPositionCommand())
.parent(AUTHME_BASE) .parent(AUTHME_BASE)
.labels("resetpos", "purgelastposition", "purgelastpos", "resetposition", .labels("resetpos", "purgelastposition", "purgelastpos", "resetposition",
"resetlastposition", "resetlastpos") "resetlastposition", "resetlastpos")
.description("Purge player's last position") .description("Purge player's last position")
.detailedDescription("Purge the last know position of the specified player.") .detailedDescription("Purge the last know position of the specified player.")
.permissions(OP_ONLY, AdminPermission.PURGE_LAST_POSITION)
.withArgument("player", "Player name", false) .withArgument("player", "Player name", false)
.permissions(OP_ONLY, AdminPermission.PURGE_LAST_POSITION)
.executableCommand(new PurgeLastPositionCommand())
.build(); .build();
// Register the purgebannedplayers command // Register the purgebannedplayers command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new PurgeBannedPlayersCommand())
.parent(AUTHME_BASE) .parent(AUTHME_BASE)
.labels("purgebannedplayers", "purgebannedplayer", "deletebannedplayers", "deletebannedplayer") .labels("purgebannedplayers", "purgebannedplayer", "deletebannedplayers", "deletebannedplayer")
.description("Purge banned players data") .description("Purge banned players data")
.detailedDescription("Purge all AuthMeReloaded data for banned players.") .detailedDescription("Purge all AuthMeReloaded data for banned players.")
.permissions(OP_ONLY, AdminPermission.PURGE_BANNED_PLAYERS) .permissions(OP_ONLY, AdminPermission.PURGE_BANNED_PLAYERS)
.executableCommand(new PurgeBannedPlayersCommand())
.build(); .build();
// Register the switchantibot command // Register the switchantibot command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new SwitchAntiBotCommand())
.parent(AUTHME_BASE) .parent(AUTHME_BASE)
.labels("switchantibot", "toggleantibot", "antibot") .labels("switchantibot", "toggleantibot", "antibot")
.description("Switch AntiBot mode") .description("Switch AntiBot mode")
.detailedDescription("Switch or toggle the AntiBot mode to the specified state.") .detailedDescription("Switch or toggle the AntiBot mode to the specified state.")
.permissions(OP_ONLY, AdminPermission.SWITCH_ANTIBOT)
.withArgument("mode", "ON / OFF", true) .withArgument("mode", "ON / OFF", true)
.permissions(OP_ONLY, AdminPermission.SWITCH_ANTIBOT)
.executableCommand(new SwitchAntiBotCommand())
.build(); .build();
// Register the reload command // Register the reload command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new ReloadCommand())
.parent(AUTHME_BASE) .parent(AUTHME_BASE)
.labels("reload", "rld") .labels("reload", "rld")
.description("Reload plugin") .description("Reload plugin")
.detailedDescription("Reload the AuthMeReloaded plugin.") .detailedDescription("Reload the AuthMeReloaded plugin.")
.permissions(OP_ONLY, AdminPermission.RELOAD) .permissions(OP_ONLY, AdminPermission.RELOAD)
.executableCommand(new ReloadCommand())
.build(); .build();
// Register the version command // Register the version command
@ -293,43 +294,43 @@ public final class CommandInitializer {
// Register the base login command // Register the base login command
final CommandDescription LOGIN_BASE = CommandDescription.builder() final CommandDescription LOGIN_BASE = CommandDescription.builder()
.executableCommand(new LoginCommand()) .parent(null)
.labels("login", "l") .labels("login", "l")
.description("Login command") .description("Login command")
.detailedDescription("Command to log in using AuthMeReloaded.") .detailedDescription("Command to log in using AuthMeReloaded.")
.parent(null)
.permissions(ALLOWED, PlayerPermission.LOGIN)
.withArgument("password", "Login password", false) .withArgument("password", "Login password", false)
.permissions(ALLOWED, PlayerPermission.LOGIN)
.executableCommand(new LoginCommand())
.build(); .build();
// Register the help command // Register the help command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(helpCommandExecutable)
.parent(LOGIN_BASE) .parent(LOGIN_BASE)
.labels(helpCommandLabels) .labels(helpCommandLabels)
.description("View Help") .description("View Help")
.detailedDescription("View detailed help pages about AuthMeReloaded login commands.") .detailedDescription("View detailed help pages about AuthMeReloaded login commands.")
.withArgument("query", "The command or query to view help for.", true) .withArgument("query", "The command or query to view help for.", true)
.executableCommand(helpCommandExecutable)
.build(); .build();
// Register the base logout command // Register the base logout command
CommandDescription LOGOUT_BASE = CommandDescription.builder() CommandDescription LOGOUT_BASE = CommandDescription.builder()
.executableCommand(new LogoutCommand())
.parent(null) .parent(null)
.labels("logout") .labels("logout")
.description("Logout command") .description("Logout command")
.detailedDescription("Command to logout using AuthMeReloaded.") .detailedDescription("Command to logout using AuthMeReloaded.")
.permissions(ALLOWED, PlayerPermission.LOGOUT) .permissions(ALLOWED, PlayerPermission.LOGOUT)
.executableCommand(new LogoutCommand())
.build(); .build();
// Register the help command // Register the help command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(helpCommandExecutable)
.parent(LOGOUT_BASE) .parent(LOGOUT_BASE)
.labels(helpCommandLabels) .labels(helpCommandLabels)
.description("View help") .description("View help")
.detailedDescription("View detailed help pages about AuthMeReloaded logout commands.") .detailedDescription("View detailed help pages about AuthMeReloaded logout commands.")
.withArgument("query", "The command or query to view help for.", true) .withArgument("query", "The command or query to view help for.", true)
.executableCommand(helpCommandExecutable)
.build(); .build();
// Register the base register command // Register the base register command
@ -346,154 +347,153 @@ public final class CommandInitializer {
// Register the help command // Register the help command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(helpCommandExecutable)
.parent(REGISTER_BASE) .parent(REGISTER_BASE)
.labels(helpCommandLabels) .labels(helpCommandLabels)
.description("View help") .description("View help")
.detailedDescription("View detailed help pages about AuthMeReloaded register commands.") .detailedDescription("View detailed help pages about AuthMeReloaded register commands.")
.withArgument("query", "The command or query to view help for.", true) .withArgument("query", "The command or query to view help for.", true)
.executableCommand(helpCommandExecutable)
.build(); .build();
// Register the base unregister command // Register the base unregister command
CommandDescription UNREGISTER_BASE = CommandDescription.builder() CommandDescription UNREGISTER_BASE = CommandDescription.builder()
.executableCommand(new UnregisterCommand())
.parent(null) .parent(null)
.labels("unreg", "unregister") .labels("unreg", "unregister")
.description("Unregistration Command") .description("Unregistration Command")
.detailedDescription("Command to unregister using AuthMeReloaded.") .detailedDescription("Command to unregister using AuthMeReloaded.")
.permissions(ALLOWED, PlayerPermission.UNREGISTER)
.withArgument("password", "Password", false) .withArgument("password", "Password", false)
.permissions(ALLOWED, PlayerPermission.UNREGISTER)
.executableCommand(new UnregisterCommand())
.build(); .build();
// Register the help command // Register the help command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(helpCommandExecutable)
.parent(UNREGISTER_BASE) .parent(UNREGISTER_BASE)
.labels(helpCommandLabels) .labels(helpCommandLabels)
.description("View help") .description("View help")
.detailedDescription("View detailed help pages about AuthMeReloaded unregister commands.") .detailedDescription("View detailed help pages about AuthMeReloaded unregister commands.")
.withArgument("query", "The command or query to view help for.", true) .withArgument("query", "The command or query to view help for.", true)
.executableCommand(helpCommandExecutable)
.build(); .build();
// Register the base changepassword command // Register the base changepassword command
final CommandDescription CHANGE_PASSWORD_BASE = CommandDescription.builder() final CommandDescription CHANGE_PASSWORD_BASE = CommandDescription.builder()
.executableCommand(new ChangePasswordCommand())
.parent(null) .parent(null)
.labels("changepassword", "changepass", "cp") .labels("changepassword", "changepass", "cp")
.description("Change password Command") .description("Change password Command")
.detailedDescription("Command to change your password using AuthMeReloaded.") .detailedDescription("Command to change your password using AuthMeReloaded.")
.permissions(ALLOWED, PlayerPermission.CHANGE_PASSWORD)
.withArgument("password", "Password", false) .withArgument("password", "Password", false)
.withArgument("verifyPassword", "Verify password.", false) .withArgument("verifyPassword", "Verify password.", false)
.permissions(ALLOWED, PlayerPermission.CHANGE_PASSWORD)
.executableCommand(new ChangePasswordCommand())
.build(); .build();
// Register the help command // Register the help command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(helpCommandExecutable)
.parent(CHANGE_PASSWORD_BASE) .parent(CHANGE_PASSWORD_BASE)
.labels(helpCommandLabels) .labels(helpCommandLabels)
.description("View help") .description("View help")
.detailedDescription("View detailed help pages about AuthMeReloaded changepassword commands.") .detailedDescription("View detailed help pages about AuthMeReloaded changepassword commands.")
.withArgument("query", "The command or query to view help for.", true) .withArgument("query", "The command or query to view help for.", true)
.executableCommand(helpCommandExecutable)
.build(); .build();
// Register the base Email command // Register the base Email command
CommandDescription EMAIL_BASE = CommandDescription.builder() CommandDescription EMAIL_BASE = CommandDescription.builder()
.executableCommand(helpCommandExecutable)
.parent(null) .parent(null)
.labels("email", "mail") .labels("email", "mail")
.description("Email command") .description("Email command")
.detailedDescription("The AuthMeReloaded Email command base.") .detailedDescription("The AuthMeReloaded Email command base.")
.executableCommand(helpCommandExecutable)
.build(); .build();
// Register the help command // Register the help command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(helpCommandExecutable)
.parent(EMAIL_BASE) .parent(EMAIL_BASE)
.labels(helpCommandLabels) .labels(helpCommandLabels)
.description("View help") .description("View help")
.detailedDescription("View detailed help pages about AuthMeReloaded email commands.") .detailedDescription("View detailed help pages about AuthMeReloaded email commands.")
.withArgument("query", "The command or query to view help for.", true) .withArgument("query", "The command or query to view help for.", true)
.executableCommand(helpCommandExecutable)
.build(); .build();
// Register the add command // Register the add command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new AddEmailCommand())
.parent(EMAIL_BASE) .parent(EMAIL_BASE)
.labels("add", "addemail", "addmail") .labels("add", "addemail", "addmail")
.description("Add Email") .description("Add Email")
.detailedDescription("Add a new email address to your account.") .detailedDescription("Add a new email address to your account.")
.permissions(ALLOWED, PlayerPermission.ADD_EMAIL)
.withArgument("email", "Email address", false) .withArgument("email", "Email address", false)
.withArgument("verifyEmail", "Email address verification", false) .withArgument("verifyEmail", "Email address verification", false)
.permissions(ALLOWED, PlayerPermission.ADD_EMAIL)
.executableCommand(new AddEmailCommand())
.build(); .build();
// Register the change command // Register the change command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new ChangeEmailCommand())
.parent(EMAIL_BASE) .parent(EMAIL_BASE)
.labels("change", "changeemail", "changemail") .labels("change", "changeemail", "changemail")
.description("Change Email") .description("Change Email")
.detailedDescription("Change an email address of your account.") .detailedDescription("Change an email address of your account.")
.permissions(ALLOWED, PlayerPermission.CHANGE_EMAIL)
.withArgument("oldEmail", "Old email address", false) .withArgument("oldEmail", "Old email address", false)
.withArgument("newEmail", "New email address", false) .withArgument("newEmail", "New email address", false)
.permissions(ALLOWED, PlayerPermission.CHANGE_EMAIL)
.executableCommand(new ChangeEmailCommand())
.build(); .build();
// Register the recover command // Register the recover command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(new RecoverEmailCommand())
.parent(EMAIL_BASE) .parent(EMAIL_BASE)
.labels("recover", "recovery", "recoveremail", "recovermail") .labels("recover", "recovery", "recoveremail", "recovermail")
.description("Recover password using Email") .description("Recover password using Email")
.detailedDescription("Recover your account using an Email address by sending a mail containing " + .detailedDescription("Recover your account using an Email address by sending a mail containing " +
"a new password.") "a new password.")
.permissions(ALLOWED, PlayerPermission.RECOVER_EMAIL)
.withArgument("email", "Email address", false) .withArgument("email", "Email address", false)
.permissions(ALLOWED, PlayerPermission.RECOVER_EMAIL)
.executableCommand(new RecoverEmailCommand())
.build(); .build();
// Register the base captcha command // Register the base captcha command
CommandDescription CAPTCHA_BASE = CommandDescription.builder() CommandDescription CAPTCHA_BASE = CommandDescription.builder()
.executableCommand(new CaptchaCommand())
.parent(null) .parent(null)
.labels("captcha", "capt") .labels("captcha", "capt")
.description("Captcha Command") .description("Captcha Command")
.detailedDescription("Captcha command for AuthMeReloaded.") .detailedDescription("Captcha command for AuthMeReloaded.")
.permissions(ALLOWED, PlayerPermission.CAPTCHA)
.withArgument("captcha", "The Captcha", false) .withArgument("captcha", "The Captcha", false)
.permissions(ALLOWED, PlayerPermission.CAPTCHA)
.executableCommand(new CaptchaCommand())
.build(); .build();
// Register the help command // Register the help command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(helpCommandExecutable)
.parent(CAPTCHA_BASE) .parent(CAPTCHA_BASE)
.labels(helpCommandLabels) .labels(helpCommandLabels)
.description("View help") .description("View help")
.detailedDescription("View detailed help pages about AuthMeReloaded captcha commands.") .detailedDescription("View detailed help pages about AuthMeReloaded captcha commands.")
.withArgument("query", "The command or query to view help for.", true) .withArgument("query", "The command or query to view help for.", true)
.executableCommand(helpCommandExecutable)
.build(); .build();
// Register the base converter command // Register the base converter command
CommandDescription CONVERTER_BASE = CommandDescription.builder() CommandDescription CONVERTER_BASE = CommandDescription.builder()
.executableCommand(new ConverterCommand())
.parent(null) .parent(null)
.labels("converter", "convert", "conv") .labels("converter", "convert", "conv")
.description("Converter Command") .description("Converter Command")
.detailedDescription("Converter command for AuthMeReloaded.") .detailedDescription("Converter command for AuthMeReloaded.")
.permissions(OP_ONLY, AdminPermission.CONVERTER)
.withArgument("job", "Conversion job: flattosql / flattosqlite /| xauth / crazylogin / rakamak / " + .withArgument("job", "Conversion job: flattosql / flattosqlite /| xauth / crazylogin / rakamak / " +
"royalauth / vauth / sqltoflat", false) "royalauth / vauth / sqltoflat", false)
.permissions(OP_ONLY, AdminPermission.CONVERTER)
.executableCommand(new ConverterCommand())
.build(); .build();
// Register the help command // Register the help command
CommandDescription.builder() CommandDescription.builder()
.executableCommand(helpCommandExecutable)
.parent(CONVERTER_BASE) .parent(CONVERTER_BASE)
.labels(helpCommandLabels) .labels(helpCommandLabels)
.description("View help") .description("View help")
.detailedDescription("View detailed help pages about AuthMeReloaded converter commands.") .detailedDescription("View detailed help pages about AuthMeReloaded converter commands.")
.withArgument("query", "The command or query to view help for.", true) .withArgument("query", "The command or query to view help for.", true)
.executableCommand(helpCommandExecutable)
.build(); .build();
// Add the base commands to the commands array // Add the base commands to the commands array