#437 Email uniqueness in admin command; finalization

- Check also in admin command that email is not already used
- Misc bug fixing (logic errors, changes lost during large merge)
- Use "email" and "setemail" as main labels for /authme subcommands
This commit is contained in:
ljacqu
2016-02-06 21:56:08 +01:00
parent b4b679d3b9
commit 2cd2b48a1a
6 changed files with 15 additions and 22 deletions
@@ -133,7 +133,7 @@ public final class CommandInitializer {
// Register the getemail command
CommandDescription.builder()
.parent(AUTHME_BASE)
.labels("getemail", "getmail", "email", "mail")
.labels("email", "mail", "getemail", "getmail")
.description("Display player's email")
.detailedDescription("Display the email address of the specified player if set.")
.withArgument("player", "Player name", true)
@@ -144,7 +144,7 @@ public final class CommandInitializer {
// Register the setemail command
CommandDescription.builder()
.parent(AUTHME_BASE)
.labels("chgemail", "chgmail", "setemail", "setmail")
.labels("setemail", "setmail", "chgemail", "chgmail")
.description("Change player's email")
.detailedDescription("Change the email address of the specified player.")
.withArgument("player", "Player name", false)
@@ -33,6 +33,9 @@ public class SetEmailCommand implements ExecutableCommand {
if (auth == null) {
commandService.send(sender, MessageKey.UNKNOWN_USER);
return;
} else if (commandService.getDataSource().isEmailStored(playerEmail)) {
commandService.send(sender, MessageKey.EMAIL_ALREADY_USED_ERROR);
return;
}
// Set the email address