#547 Create ProcessService

- Create ProcessService for common tasks within processes
- Integrate service into AsyncAddEmail
This commit is contained in:
ljacqu
2016-02-20 19:56:45 +01:00
parent 28108f00f1
commit d664e7be26
8 changed files with 122 additions and 87 deletions
@@ -0,0 +1,34 @@
package fr.xephi.authme.process;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.settings.NewSetting;
import fr.xephi.authme.settings.domain.Property;
import org.bukkit.command.CommandSender;
/**
* Service for asynchronous and synchronous processes.
*/
public class ProcessService {
private final NewSetting settings;
private final Messages messages;
public ProcessService(NewSetting settings, Messages messages) {
this.settings = settings;
this.messages = messages;
}
public <T> T getProperty(Property<T> property) {
return settings.getProperty(property);
}
public NewSetting getSettings() {
return settings;
}
public void send(CommandSender sender, MessageKey key) {
messages.send(sender, key);
}
}