From af836cdee1521fa5d2161d18f383c84e3bcb9fbf Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Fri, 24 Nov 2023 21:39:46 -0800 Subject: [PATCH] Fix double welcome mail creation --- src/main/java/emu/lunarcore/game/player/Player.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/emu/lunarcore/game/player/Player.java b/src/main/java/emu/lunarcore/game/player/Player.java index 289f8cd..9605246 100644 --- a/src/main/java/emu/lunarcore/game/player/Player.java +++ b/src/main/java/emu/lunarcore/game/player/Player.java @@ -121,6 +121,7 @@ public class Player { @Setter private transient RogueInstance rogueInstance; // Etc + private transient boolean isNew; private transient boolean loggedIn; private transient boolean inAnchorRange; private transient int nextBattleId; @@ -145,6 +146,7 @@ public class Player { this(); this.session = session; this.accountUid = getAccount().getUid(); + this.isNew = true; this.initUid(); this.resetPosition(); @@ -169,9 +171,6 @@ public class Player { this.addAvatar(avatar); this.getCurrentLineup().getAvatars().add(avatar.getAvatarId()); this.getCurrentLineup().save(); - - // Welcome mail - this.getMailbox().sendWelcomeMail(); } public GameServer getServer() { @@ -654,6 +653,11 @@ public class Player { this.enterScene(GameConstants.START_ENTRY_ID, 0, false); } + // Send welcome mail after we load managers from the database + if (this.isNew) { + this.getMailbox().sendWelcomeMail(); + } + // Set logged in flag this.lastActiveTime = System.currentTimeMillis() / 1000; this.loggedIn = true;