From 16ca1b80b83f8473dae539719d2b8b506e7af8d7 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Tue, 24 Feb 2015 21:52:46 -0500 Subject: [PATCH] =?UTF-8?q?Al=C3=A8gement=20du=20code=20g=C3=A9rant=20l'af?= =?UTF-8?q?fichage=20des=20messages=20'Pseudo=20vient=20de=20se=20connecte?= =?UTF-8?q?r'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/LoginLogoutMessageManager.java | 26 ++----------------- .../pandacraftutils/players/OnlinePlayer.java | 8 ++++++ 2 files changed, 10 insertions(+), 24 deletions(-) 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; /**