- 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.
42 lines
1.3 KiB
Java
42 lines
1.3 KiB
Java
package fr.xephi.authme.process.register;
|
|
|
|
import fr.xephi.authme.ConsoleLogger;
|
|
import fr.xephi.authme.message.MessageKey;
|
|
import fr.xephi.authme.permission.AuthGroupType;
|
|
import fr.xephi.authme.service.CommonService;
|
|
import fr.xephi.authme.process.SynchronousProcess;
|
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
|
import fr.xephi.authme.task.LimboPlayerTaskManager;
|
|
import fr.xephi.authme.util.PlayerUtils;
|
|
import org.bukkit.entity.Player;
|
|
|
|
import javax.inject.Inject;
|
|
|
|
|
|
public class ProcessSyncEmailRegister implements SynchronousProcess {
|
|
|
|
@Inject
|
|
private CommonService service;
|
|
|
|
@Inject
|
|
private LimboPlayerTaskManager limboPlayerTaskManager;
|
|
|
|
ProcessSyncEmailRegister() {
|
|
}
|
|
|
|
public void processEmailRegister(Player player) {
|
|
final String name = player.getName().toLowerCase();
|
|
if (!service.getProperty(HooksSettings.REGISTERED_GROUP).isEmpty()) {
|
|
service.setGroup(player, AuthGroupType.REGISTERED);
|
|
}
|
|
service.send(player, MessageKey.ACCOUNT_NOT_ACTIVATED);
|
|
|
|
limboPlayerTaskManager.registerTimeoutTask(player);
|
|
limboPlayerTaskManager.registerMessageTask(name, true);
|
|
|
|
player.saveData();
|
|
ConsoleLogger.fine(player.getName() + " registered " + PlayerUtils.getPlayerIp(player));
|
|
}
|
|
|
|
}
|