Gestion du vanish dans la commande /list

This commit is contained in:
Marc Baloup 2015-01-02 19:19:27 -05:00
parent 4d2008572c
commit 49246f233e
3 changed files with 19 additions and 7 deletions

View File

@ -100,6 +100,7 @@ public class PandacraftUtils extends JavaPlugin {
commandMe = null; commandMe = null;
commandSpeedMessage = null; commandSpeedMessage = null;
commandAliasManager = null;
spawnTimeManager = null; spawnTimeManager = null;
chatAnalysisManager = null; chatAnalysisManager = null;
creativCheatManager = null; creativCheatManager = null;

View File

@ -21,13 +21,11 @@ public class EssentialsInterface {
try { try {
Essentials ess = (Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials"); Essentials ess = (Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials");
return ess.getUser(p).canSee(hiddenP); return ess.getUser(p).canSee(hiddenP);
} catch (Exception e) { } } catch (Exception e) { }
return false; return true;
} }
public static boolean isPlayerMuted(Player p) { public static boolean isPlayerMuted(Player p) {
try { try {
return ((Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials")).getUser(p).isMuted(); return ((Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials")).getUser(p).isMuted();

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
import net.mc_pandacraft.java.plugin.pandacraftutils.afk.AfkPlayer; 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 net.mc_pandacraft.java.util.TimeUtil;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -44,7 +45,19 @@ public class CommandList implements CommandExecutor {
if (execute) if (execute)
{ {
Server s = plugin.getServer(); Server s = plugin.getServer();
Player[] pls = plugin.getServer().getOnlinePlayers();
Player[] plso = plugin.getServer().getOnlinePlayers();
ArrayList<Player> pls = new ArrayList<Player>();
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 = "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 = '-'; char decoration_motif = '-';
ArrayList<String> aff_list = new ArrayList<String>(); ArrayList<String> aff_list = new ArrayList<String>();
@ -208,7 +221,7 @@ public class CommandList implements CommandExecutor {
} }
if (pls.length > 0) if (pls.size() > 0)
{ {
aff_list.add(joueurs); aff_list.add(joueurs);
} }