From 84fb7eec361c964adb7675785abcf2a7b74e8730 Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 6 Feb 2013 16:52:36 -0500 Subject: [PATCH] Move this out of PlayerLoginEvent and into PlayerJoinEvent - this prevents us from creating DB entries for players that get caught by a whitelist. --- .../nossr50/listeners/PlayerListener.java | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index be1189497..de603d9a2 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -14,7 +14,6 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.inventory.ItemStack; @@ -111,23 +110,6 @@ public class PlayerListener implements Listener { } } - /** - * Monitor PlayerLogin events. - * - * @param event The event to watch - */ - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onPlayerLogin(PlayerLoginEvent event) { - Player player = event.getPlayer(); - - /* We can't use the other check here because a profile hasn't been created yet.*/ - if (player == null || player.hasMetadata("NPC")) { - return; - } - - Users.addUser(player).getProfile().actualizeRespawnATS(); - } - /** * Monitor PlayerQuit events. * @@ -154,10 +136,13 @@ public class PlayerListener implements Listener { public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); - if (Misc.isNPCPlayer(player)) { + /* We can't use the other check here because a profile hasn't been created yet.*/ + if (player == null || player.hasMetadata("NPC")) { return; } + Users.addUser(player).getProfile().actualizeRespawnATS(); + if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) { Motd.displayAll(player); }