Exemplo n.º 1
0
 @Override
 public void runCommand(Player player, List<String> arguments) {
   PlayerAuth auth = playerCache.getAuth(player.getName());
   if (auth.getEmail() != null && !"*****@*****.**".equalsIgnoreCase(auth.getEmail())) {
     commonService.send(player, MessageKey.EMAIL_SHOW, auth.getEmail());
   } else {
     commonService.send(player, MessageKey.SHOW_NO_EMAIL);
   }
 }
  @Override
  public void runCommand(Player player, List<String> arguments) {
    String oldPassword = arguments.get(0);
    String newPassword = arguments.get(1);

    String name = player.getName().toLowerCase();
    if (!playerCache.isAuthenticated(name)) {
      commonService.send(player, MessageKey.NOT_LOGGED_IN);
      return;
    }

    // Make sure the password is allowed
    ValidationResult passwordValidation = validationService.validatePassword(newPassword, name);
    if (passwordValidation.hasError()) {
      commonService.send(player, passwordValidation.getMessageKey(), passwordValidation.getArgs());
      return;
    }

    management.performPasswordChange(player, oldPassword, newPassword);
  }