Merge CommandService and ProcessService to CommonService

- Replace CommandService and ProcessService with CommonService: a service that offers our typical needs to work with settings, messages and permissions
- Remove validation methods from CommonService: inject ValidationService directly. Validation methods are not used very frequently and therefore don't belong in CommonService. Their presence was a relict from our architecture before injection was used.
This commit is contained in:
ljacqu
2016-12-03 12:10:30 +01:00
parent a38d3a25b8
commit c325d0db41
55 changed files with 317 additions and 553 deletions
@@ -6,7 +6,7 @@ import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.security.crypts.HashedPassword;
import org.bukkit.entity.Player;
@@ -19,7 +19,7 @@ public class AsyncChangePassword implements AsynchronousProcess {
private DataSource dataSource;
@Inject
private ProcessService processService;
private CommonService commonService;
@Inject
private PasswordSecurity passwordSecurity;
@@ -39,15 +39,15 @@ public class AsyncChangePassword implements AsynchronousProcess {
auth.setPassword(hashedPassword);
if (!dataSource.updatePassword(auth)) {
processService.send(player, MessageKey.ERROR);
commonService.send(player, MessageKey.ERROR);
return;
}
playerCache.updatePlayer(auth);
processService.send(player, MessageKey.PASSWORD_CHANGED_SUCCESS);
commonService.send(player, MessageKey.PASSWORD_CHANGED_SUCCESS);
ConsoleLogger.info(player.getName() + " changed his password");
} else {
processService.send(player, MessageKey.WRONG_PASSWORD);
commonService.send(player, MessageKey.WRONG_PASSWORD);
}
}
}