diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/LoginLogoutMessageManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/LoginLogoutMessageManager.java index 9997125..6faa809 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/LoginLogoutMessageManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/LoginLogoutMessageManager.java @@ -1,14 +1,10 @@ package net.mc_pandacraft.java.plugin.pandacraftutils.modules; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; +import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager; import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface; import org.bukkit.ChatColor; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; @@ -20,8 +16,6 @@ public class LoginLogoutMessageManager implements Listener { private PandacraftUtils plugin = PandacraftUtils.getInstance(); - private List loggedInPlayer = new ArrayList(); - public LoginLogoutMessageManager() { @@ -37,7 +31,6 @@ public class LoginLogoutMessageManager implements Listener { @EventHandler public void onxAuthLogin(xAuthLoginEvent event) { - loggedInPlayer.add(event.getPlayer()); if (EssentialsInterface.isPlayerVanished(event.getPlayer())) return; @@ -48,11 +41,9 @@ public class LoginLogoutMessageManager implements Listener { public void onPlayerQuit(PlayerQuitEvent event) { event.setQuitMessage(null); - if (!isPlayerLoggedIn(event.getPlayer())) + if (!OnlinePlayerManager.get(event.getPlayer()).isAuthenticated()) return; - loggedInPlayer.remove(event.getPlayer()); - // on affiche le message que si le joueur n'est pas vanish if (EssentialsInterface.isPlayerVanished(event.getPlayer())) return; @@ -61,17 +52,4 @@ public class LoginLogoutMessageManager implements Listener { - - public List getLoggedInPlayers() { return loggedInPlayer; } - - public List getLoggedOutPlayers() { - List players = new ArrayList(Arrays.asList(plugin.getServer().getOnlinePlayers())); - players.removeAll(loggedInPlayer); - return players; - } - - public boolean isPlayerLoggedIn(Player p) { - return loggedInPlayer.contains(p); - } - } diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayer.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayer.java index 89df419..7160d67 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayer.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayer.java @@ -17,6 +17,7 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.entity.Tameable; +import de.luricos.bukkit.xAuth.xAuth; import ru.tehkode.permissions.bukkit.PermissionsEx; public class OnlinePlayer { @@ -315,6 +316,13 @@ public class OnlinePlayer { + + public boolean isAuthenticated() { + return xAuth.getPlugin().getPlayerManager().getPlayer(player).isAuthenticated(); + } + + + private boolean hasAlreadyReceivedMessageFromNetworkAPI = false; /**