Converted two commands to use the builder

This commit is contained in:
Tim Visée 2015-12-01 16:24:24 +01:00
parent 999c08956d
commit 4afef9714d
3 changed files with 21 additions and 23 deletions

View File

@ -135,29 +135,27 @@ public class CommandManager {
.build(); .build();
// Register the getemail command // Register the getemail command
CommandDescription getEmailCommand = new CommandDescription(new GetEmailCommand(), new ArrayList<String>() { CommandDescription getEmailCommand = CommandDescription.builder()
{ .executableCommand(new GetEmailCommand())
add("getemail"); .labels("getemail", "getmail", "email", "mail")
add("getmail"); .description("Display player's email")
add("email"); .detailedDescription("Display the email address of the specified player if set.")
add("mail"); .parent(authMeBaseCommand)
} .permissions(OP_ONLY, AdminPermission.GET_EMAIL)
}, "Display player's email", "Display the email address of the specified player if set.", authMeBaseCommand); .withArgument("player", "Player name", true)
getEmailCommand.setCommandPermissions(AdminPermission.GET_EMAIL, OP_ONLY); .build();
getEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", true));
// Register the setemail command // Register the setemail command
CommandDescription setEmailCommand = new CommandDescription(new SetEmailCommand(), new ArrayList<String>() { CommandDescription setEmailCommand = CommandDescription.builder()
{ .executableCommand(new SetEmailCommand())
add("chgemail"); .labels("chgemail", "chgmail", "setemail", "setmail")
add("chgmail"); .description("Change player's email")
add("setemail"); .detailedDescription("Change the email address of the specified player.")
add("setmail"); .parent(authMeBaseCommand)
} .permissions(OP_ONLY, AdminPermission.CHANGE_EMAIL)
}, "Change player's email", "Change the email address of the specified player.", authMeBaseCommand); .withArgument("player", "Player name", false)
setEmailCommand.setCommandPermissions(AdminPermission.CHANGE_EMAIL, OP_ONLY); .withArgument("email", "Player email", false)
setEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", false)); .build();
setEmailCommand.addArgument(new CommandArgumentDescription("email", "Player email", false));
// Register the getip command // Register the getip command
CommandDescription getIpCommand = new CommandDescription(new GetIpCommand(), new ArrayList<String>() { CommandDescription getIpCommand = new CommandDescription(new GetIpCommand(), new ArrayList<String>() {

View File

@ -1,7 +1,7 @@
package fr.xephi.authme.permission; package fr.xephi.authme.permission;
/** /**
* AuthMe admin permissions. * AuthMe admin command permissions.
*/ */
public enum AdminPermission implements PermissionNode { public enum AdminPermission implements PermissionNode {

View File

@ -1,7 +1,7 @@
package fr.xephi.authme.permission; package fr.xephi.authme.permission;
/** /**
* AuthMe player permission nodes, for regular players. * AuthMe player command permission nodes, for regular players.
*/ */
public enum PlayerPermission implements PermissionNode { public enum PlayerPermission implements PermissionNode {