diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java index 52d4b48..2417884 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java @@ -55,7 +55,7 @@ public class ConfigManager { /* * Insultes */ - ChatAnalysis_badWords.add("putes?"); + ChatAnalysis_badWords.add("pu+tes?"); ChatAnalysis_badWords.add("conn?a(rd?|ss?e?)"); ChatAnalysis_badWords.add("sal(o|au)pe?s?"); ChatAnalysis_badWords.add("[ea]ncul(é|e|er|ai(s|t|))"); diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/login_message/LoginLogoutManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/login_message/LoginLogoutManager.java index c04002a..c60c4b8 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/login_message/LoginLogoutManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/login_message/LoginLogoutManager.java @@ -1,8 +1,13 @@ package net.mc_pandacraft.java.plugin.pandacraftutils.login_message; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; 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; @@ -14,6 +19,8 @@ public class LoginLogoutManager implements Listener { private PandacraftUtils plugin; + private List loggedInPlayer = new ArrayList(); + public LoginLogoutManager(PandacraftUtils pl) { plugin = pl; @@ -31,12 +38,30 @@ public class LoginLogoutManager implements Listener { @EventHandler public void onxAuthLogin(xAuthLoginEvent event) { plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" vient de se connecter"); + loggedInPlayer.add(event.getPlayer()); } - @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { + event.setQuitMessage(null); + + if (!isPlayerLoggedIn(event.getPlayer())) + return; + loggedInPlayer.remove(event.getPlayer()); event.setQuitMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" a quitté le jeu"); } + + public List getLoggedInPlayer() { return loggedInPlayer; } + + public List getLoggedOutPlayer() { + List players = new ArrayList(Arrays.asList(plugin.getServer().getOnlinePlayers())); + players.removeAll(loggedInPlayer); + return players; + } + + public boolean isPlayerLoggedIn(Player p) { + return loggedInPlayer.contains(p); + } + }