mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Vanished admins are no longer being counted (FS-148) (#41)
This commit is contained in:
parent
debb95fb4c
commit
d11d55b218
@ -1,7 +1,5 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
@ -14,10 +12,14 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-s | -i | -f | -v]", aliases = "who,lsit")
|
||||
public class Command_list extends FreedomCommand
|
||||
{
|
||||
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 1)
|
||||
@ -29,7 +31,10 @@ public class Command_list extends FreedomCommand
|
||||
List<String> names = new ArrayList<>();
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
names.add(player.getName());
|
||||
if (!plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
names.add(player.getName());
|
||||
}
|
||||
}
|
||||
msg("There are " + names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join(names, ", "), ChatColor.WHITE);
|
||||
return true;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.totalfreedom.totalfreedommod.httpd.module;
|
||||
|
||||
import java.util.Collection;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
@ -10,6 +10,8 @@ import org.bukkit.entity.Player;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class Module_list extends HTTPDModule
|
||||
{
|
||||
|
||||
@ -95,7 +97,7 @@ public class Module_list extends HTTPDModule
|
||||
responseObject.put("master_builders", masterbuilders);
|
||||
responseObject.put("operators", operators);
|
||||
responseObject.put("imposters", imposters);
|
||||
responseObject.put("online", server.getOnlinePlayers().size());
|
||||
responseObject.put("online", server.getOnlinePlayers().size() - AdminList.vanished.size());
|
||||
responseObject.put("max", server.getMaxPlayers());
|
||||
|
||||
final NanoHTTPD.Response response = new NanoHTTPD.Response(NanoHTTPD.Response.Status.OK, NanoHTTPD.MIME_JSON, responseObject.toString());
|
||||
@ -108,7 +110,8 @@ public class Module_list extends HTTPDModule
|
||||
|
||||
final Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers();
|
||||
|
||||
body.append("<p>There are ").append(onlinePlayers.size()).append("/").append(Bukkit.getMaxPlayers()).append(" players online:</p>\r\n");
|
||||
body.append("<p>There are ").append(onlinePlayers.size() - AdminList.vanished.size()).append("/")
|
||||
.append(Bukkit.getMaxPlayers()).append(" players online:</p>\r\n");
|
||||
|
||||
body.append("<ul>\r\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user