diff --git a/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java b/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java index 9dace0f2a..d5908820e 100644 --- a/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java +++ b/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java @@ -1,6 +1,7 @@ package fr.xephi.authme.process.email; import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.datasource.DataSource; @@ -46,12 +47,15 @@ public class AsyncAddEmail { messages.send(player, MessageKey.INVALID_EMAIL); } else if (dataSource.isEmailStored(email)) { messages.send(player, MessageKey.EMAIL_ALREADY_USED_ERROR); - } else if (dataSource.updateEmail(auth)) { - auth.setEmail(email); - playerCache.updatePlayer(auth); - messages.send(player, MessageKey.EMAIL_ADDED_SUCCESS); } else { - messages.send(player, MessageKey.ERROR); + auth.setEmail(email); + if (dataSource.updateEmail(auth)) { + playerCache.updatePlayer(auth); + messages.send(player, MessageKey.EMAIL_ADDED_SUCCESS); + } else { + ConsoleLogger.showError("Could not save email for player '" + player + "'"); + messages.send(player, MessageKey.ERROR); + } } } else { sendUnloggedMessage(dataSource); diff --git a/src/test/java/fr/xephi/authme/process/email/AsyncAddEmailTest.java b/src/test/java/fr/xephi/authme/process/email/AsyncAddEmailTest.java index fb4c7fd57..7cc7c55df 100644 --- a/src/test/java/fr/xephi/authme/process/email/AsyncAddEmailTest.java +++ b/src/test/java/fr/xephi/authme/process/email/AsyncAddEmailTest.java @@ -1,6 +1,7 @@ package fr.xephi.authme.process.email; import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLoggerTestInitializer; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.datasource.DataSource; @@ -35,6 +36,7 @@ public class AsyncAddEmailTest { @BeforeClass public static void setUp() { WrapperMock.createInstance(); + ConsoleLoggerTestInitializer.setupLogger(); } // Clean up the fields to ensure that no test uses elements of another test