Correction de bug avec les messages de login / logout
This commit is contained in:
parent
a03a3f373a
commit
f5f899b771
@ -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|))");
|
||||
|
@ -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<Player> loggedInPlayer = new ArrayList<Player>();
|
||||
|
||||
|
||||
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<Player> getLoggedInPlayer() { return loggedInPlayer; }
|
||||
|
||||
public List<Player> getLoggedOutPlayer() {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user