diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java index bd561012f..77fd72784 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java @@ -1,12 +1,12 @@ package mineplex.hub.mail; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniClientPlugin; -import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; -import mineplex.core.account.event.RetrieveClientInformationEvent; import mineplex.core.donation.DonationManager; import mineplex.hub.mail.command.MailCommand; import mineplex.hub.mail.gui.MailShop; @@ -34,18 +34,15 @@ public class MailManager extends MiniClientPlugin return new PlayerMailData(); } - @Override - protected void loadClientInformation(final RetrieveClientInformationEvent event) + @EventHandler + protected void loadPlayerData(final PlayerJoinEvent event) { - event.incrementProcessingCount(); - runAsync(new Runnable() { @Override public void run() { - Set(event.getPlayerName(), _repository.loadMailData(event.getUniqueId())); - event.decreaseProcessingCount(); + Set(event.getPlayer().getName(), _repository.loadMailData(event.getPlayer().getUniqueId())); } }); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java index 3153d96c6..5969b0240 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java @@ -43,7 +43,7 @@ public class MailRepository extends RepositoryBase Result resultSet = context.selectFrom(Tables.mail).where(Tables.mail.accountId.eq(DSL.select(Tables.accounts.id) .from(Tables.accounts) .where(Tables.accounts.uuid.eq(uuid.toString()))) - ).fetch(); + ).and(Tables.mail.deleted.isFalse()).fetch(); for (MailRecord record : resultSet) {