From 49246f233eb2b24ea788339ee15e6f886aa4355c Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Fri, 2 Jan 2015 19:19:27 -0500 Subject: [PATCH] Gestion du vanish dans la commande /list --- .../pandacraftutils/PandacraftUtils.java | 1 + .../plugin_interface/EssentialsInterface.java | 6 ++---- .../simple_commands/list/CommandList.java | 19 ++++++++++++++++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java index 5dae9da..a31aabd 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java @@ -100,6 +100,7 @@ public class PandacraftUtils extends JavaPlugin { commandMe = null; commandSpeedMessage = null; + commandAliasManager = null; spawnTimeManager = null; chatAnalysisManager = null; creativCheatManager = null; diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/plugin_interface/EssentialsInterface.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/plugin_interface/EssentialsInterface.java index 98f8ecd..7a01a2d 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/plugin_interface/EssentialsInterface.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/plugin_interface/EssentialsInterface.java @@ -21,13 +21,11 @@ public class EssentialsInterface { try { Essentials ess = (Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials"); - - return ess.getUser(p).canSee(hiddenP); } catch (Exception e) { } - return false; + return true; } - + public static boolean isPlayerMuted(Player p) { try { return ((Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials")).getUser(p).isMuted(); diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/list/CommandList.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/list/CommandList.java index 1e7bf4b..d19c2a1 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/list/CommandList.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/list/CommandList.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; import net.mc_pandacraft.java.plugin.pandacraftutils.afk.AfkPlayer; +import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface; import net.mc_pandacraft.java.util.TimeUtil; import org.bukkit.GameMode; @@ -44,7 +45,19 @@ public class CommandList implements CommandExecutor { if (execute) { Server s = plugin.getServer(); - Player[] pls = plugin.getServer().getOnlinePlayers(); + + + Player[] plso = plugin.getServer().getOnlinePlayers(); + ArrayList pls = new ArrayList(); + for (Player p : plso) + { + // le joueur exécutant la commande ne peut pas voir le joueur courant + if (sender instanceof Player && !EssentialsInterface.canPlayerSeeVanishedPlayer((Player)sender, p)) + continue; + + pls.add(p); + } + @@ -71,7 +84,7 @@ public class CommandList implements CommandExecutor { header = "Liste des joueurs"; } - header = header.concat(" (§7"+pls.length+decoration_color+"/§7"+s.getMaxPlayers()+decoration_color+")"); + header = header.concat(" (§7"+pls.size()+decoration_color+"/§7"+s.getMaxPlayers()+decoration_color+")"); char decoration_motif = '-'; ArrayList aff_list = new ArrayList(); @@ -208,7 +221,7 @@ public class CommandList implements CommandExecutor { } - if (pls.length > 0) + if (pls.size() > 0) { aff_list.add(joueurs); }