mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Move profile creation back to Login event, but only if the login is
allowed.
This commit is contained in:
parent
05a9c8b7e5
commit
80b7cc717f
@ -17,6 +17,8 @@ import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
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.PlayerLoginEvent.Result;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
@ -113,6 +115,25 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor PlayerLogin events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerLoginEvent(PlayerLoginEvent event) {
|
||||
if (event.getResult() == Result.ALLOWED) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle PlayerDropItem events that involve modifying the event.
|
||||
*
|
||||
@ -209,13 +230,6 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerJoin(PlayerJoinEvent 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();
|
||||
|
||||
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
|
||||
Motd.displayAll(player);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user