Minor fixes + code householding

- Fix SpawnCommandTest testing FirstSpawnCommand
- Fix javadoc errors
- Map TODO's to issue numbers where applicable
- Fix trivial TODO's
This commit is contained in:
ljacqu
2016-03-13 11:09:27 +01:00
parent 00125487f1
commit 5d12ec8b56
12 changed files with 46 additions and 32 deletions
@@ -2,6 +2,7 @@ package fr.xephi.authme.process;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.IpAddressManager;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.hooks.PluginHooks;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -22,16 +23,19 @@ public class ProcessService {
private final NewSetting settings;
private final Messages messages;
private final AuthMe authMe;
private final DataSource dataSource;
private final IpAddressManager ipAddressManager;
private final PasswordSecurity passwordSecurity;
private final PluginHooks pluginHooks;
private final SpawnLoader spawnLoader;
public ProcessService(NewSetting settings, Messages messages, AuthMe authMe, IpAddressManager ipAddressManager,
PasswordSecurity passwordSecurity, PluginHooks pluginHooks, SpawnLoader spawnLoader) {
public ProcessService(NewSetting settings, Messages messages, AuthMe authMe, DataSource dataSource,
IpAddressManager ipAddressManager, PasswordSecurity passwordSecurity, PluginHooks pluginHooks,
SpawnLoader spawnLoader) {
this.settings = settings;
this.messages = messages;
this.authMe = authMe;
this.dataSource = dataSource;
this.ipAddressManager = ipAddressManager;
this.passwordSecurity = passwordSecurity;
this.pluginHooks = pluginHooks;
@@ -98,4 +102,8 @@ public class ProcessService {
return spawnLoader;
}
public DataSource getDataSource() {
return dataSource;
}
}
@@ -34,12 +34,13 @@ public class AsynchronousUnregister implements Process {
private final ProcessService service;
/**
* Constructor for AsynchronousUnregister.
* Constructor.
*
* @param player Player
* @param password String
* @param force boolean
* @param plugin AuthMe
* @param player The player to perform the action for
* @param password The password
* @param force True to bypass password validation
* @param plugin The plugin instance
* @param service The process service
*/
public AsynchronousUnregister(Player player, String password, boolean force, AuthMe plugin,
ProcessService service) {
@@ -57,7 +58,7 @@ public class AsynchronousUnregister implements Process {
PlayerAuth cachedAuth = PlayerCache.getInstance().getAuth(name);
if (force || plugin.getPasswordSecurity().comparePassword(
password, cachedAuth.getPassword(), player.getName())) {
if (!plugin.getDataSource().removeAuth(name)) {
if (!service.getDataSource().removeAuth(name)) {
service.send(player, MessageKey.ERROR);
return;
}