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;
commandSpeedMessage = null;
commandAliasManager = null;
spawnTimeManager = null;
chatAnalysisManager = null;
creativCheatManager = null;

View File

@ -21,11 +21,9 @@ 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) {

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.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<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 = 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<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);
}