From 223fff4b52c06d2105c34bd099db53e1408dafd5 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 02:11:58 +0200 Subject: [PATCH] New attempt to fix the broken email registration -_- --- .../register/ProcessSyncronousEmailRegister.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index d2b25414d..2ba9f63d4 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -8,6 +8,7 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; @@ -28,6 +29,7 @@ public class ProcessSyncronousEmailRegister implements Runnable { @Override public void run() { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); if (!Settings.getRegisteredGroup.isEmpty()) { Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED); } @@ -36,12 +38,16 @@ public class ProcessSyncronousEmailRegister implements Runnable { int msgInterval = Settings.getWarnMessageInterval; BukkitScheduler sched = plugin.getServer().getScheduler(); - if (time != 0) { + if (time != 0 && limbo != null) { + limbo.getTimeoutTaskId().cancel(); BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); - LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); + limbo.setTimeoutTaskId(id); + } + if (limbo != null){ + limbo.getMessageTaskId().cancel(); + BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); + limbo.setMessageTaskId(nwMsg); } - BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); - LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg); player.saveData(); if (!Settings.noConsoleSpam)