mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-09-18 18:01:22 +02:00
#843 Fix NPE upon registration
- Let login classes handle the login process, remove duplications in register classes
This commit is contained in:
parent
4f68589b76
commit
97274d8c19
@ -5,7 +5,6 @@ import com.google.common.io.ByteStreams;
|
|||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||||
import fr.xephi.authme.events.LoginEvent;
|
|
||||||
import fr.xephi.authme.output.MessageKey;
|
import fr.xephi.authme.output.MessageKey;
|
||||||
import fr.xephi.authme.permission.AuthGroupType;
|
import fr.xephi.authme.permission.AuthGroupType;
|
||||||
import fr.xephi.authme.process.ProcessService;
|
import fr.xephi.authme.process.ProcessService;
|
||||||
@ -16,15 +15,12 @@ import fr.xephi.authme.settings.properties.HooksSettings;
|
|||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||||
import fr.xephi.authme.util.BukkitService;
|
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
||||||
@ -35,9 +31,6 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
|||||||
@Inject
|
@Inject
|
||||||
private ProcessService service;
|
private ProcessService service;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private BukkitService bukkitService;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private LimboCache limboCache;
|
private LimboCache limboCache;
|
||||||
|
|
||||||
@ -84,12 +77,6 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void processPasswordRegister(Player player) {
|
public void processPasswordRegister(Player player) {
|
||||||
final String name = player.getName().toLowerCase();
|
|
||||||
if (limboCache.hasPlayerData(name)) {
|
|
||||||
limboCache.restoreData(player);
|
|
||||||
limboCache.deletePlayerData(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Settings.getRegisteredGroup.isEmpty()) {
|
if (!Settings.getRegisteredGroup.isEmpty()) {
|
||||||
service.setGroup(player, AuthGroupType.REGISTERED);
|
service.setGroup(player, AuthGroupType.REGISTERED);
|
||||||
}
|
}
|
||||||
@ -100,12 +87,6 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
|||||||
service.send(player, MessageKey.ADD_EMAIL_MESSAGE);
|
service.send(player, MessageKey.ADD_EMAIL_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) {
|
|
||||||
player.removePotionEffect(PotionEffectType.BLINDNESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The LoginEvent now fires (as intended) after everything is processed
|
|
||||||
bukkitService.callEvent(new LoginEvent(player));
|
|
||||||
player.saveData();
|
player.saveData();
|
||||||
|
|
||||||
if (!service.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
|
if (!service.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user