#432 #547 Remove public IP cache map; make processes use ProcessService

- Create IP address manager for handling and caching IP addresses -> outside of the manager I do not want to care about caching details
- Make more processes use the ProcessService in favor of statically injected objects
This commit is contained in:
ljacqu
2016-03-01 22:41:32 +01:00
parent 86042070e9
commit aeb8307a46
20 changed files with 330 additions and 296 deletions
@@ -1,6 +1,7 @@
package fr.xephi.authme.process;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.manager.IpAddressManager;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.settings.NewSetting;
@@ -17,11 +18,13 @@ public class ProcessService {
private final NewSetting settings;
private final Messages messages;
private final AuthMe authMe;
private final IpAddressManager ipAddressManager;
public ProcessService(NewSetting settings, Messages messages, AuthMe authMe) {
public ProcessService(NewSetting settings, Messages messages, AuthMe authMe, IpAddressManager ipAddressManager) {
this.settings = settings;
this.messages = messages;
this.authMe = authMe;
this.ipAddressManager = ipAddressManager;
}
public <T> T getProperty(Property<T> property) {
@@ -36,7 +39,15 @@ public class ProcessService {
messages.send(sender, key);
}
public String retrieveMessage(MessageKey key) {
public void send(CommandSender sender, MessageKey key, String... replacements) {
messages.send(sender, key, replacements);
}
public String[] retrieveMessage(MessageKey key) {
return messages.retrieve(key);
}
public String retrieveSingleMessage(MessageKey key) {
return messages.retrieveSingle(key);
}
@@ -60,4 +71,8 @@ public class ProcessService {
return authMe;
}
public IpAddressManager getIpAddressManager() {
return ipAddressManager;
}
}