mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Move this out of PlayerLoginEvent and into PlayerJoinEvent -
this prevents us from creating DB entries for players that get caught by a whitelist.
This commit is contained in:
parent
c04b5dc4d6
commit
84fb7eec36
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user