Alègement du code gérant l'affichage des messages 'Pseudo vient de se connecter'
This commit is contained in:
parent
c83a412d0f
commit
16ca1b80b8
@ -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<Player> loggedInPlayer = new ArrayList<Player>();
|
||||
|
||||
|
||||
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<Player> getLoggedInPlayers() { return loggedInPlayer; }
|
||||
|
||||
public List<Player> getLoggedOutPlayers() {
|
||||
List<Player> players = new ArrayList<Player>(Arrays.asList(plugin.getServer().getOnlinePlayers()));
|
||||
players.removeAll(loggedInPlayer);
|
||||
return players;
|
||||
}
|
||||
|
||||
public boolean isPlayerLoggedIn(Player p) {
|
||||
return loggedInPlayer.contains(p);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user