mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Added "/list -a".
This commit is contained in:
parent
f3b04ee828
commit
156cf7efd3
@ -1,5 +1,5 @@
|
||||
#Sat, 23 Mar 2013 17:16:26 -0400
|
||||
#Sun, 24 Mar 2013 16:31:08 -0400
|
||||
|
||||
program.VERSION=2.12
|
||||
program.BUILDNUM=110
|
||||
program.BUILDDATE=03/23/2013 05\:16 PM
|
||||
program.BUILDNUM=111
|
||||
program.BUILDDATE=03/24/2013 04\:31 PM
|
||||
|
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Sat Mar 23 17:16:26 EDT 2013
|
||||
build.number=111
|
||||
#Sun Mar 24 16:31:08 EDT 2013
|
||||
build.number=112
|
||||
|
@ -13,6 +13,11 @@ import org.bukkit.entity.Player;
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
public class Command_list extends TFM_Command
|
||||
{
|
||||
private static enum ListFilter
|
||||
{
|
||||
SHOW_ALL, SHOW_ADMINS
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -27,6 +32,15 @@ public class Command_list extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
ListFilter listFilter = ListFilter.SHOW_ALL;
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("-a"))
|
||||
{
|
||||
listFilter = ListFilter.SHOW_ADMINS;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder onlineStats = new StringBuilder();
|
||||
StringBuilder onlineUsers = new StringBuilder();
|
||||
|
||||
@ -37,9 +51,16 @@ public class Command_list extends TFM_Command
|
||||
List<String> player_names = new ArrayList<String>();
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
boolean userSuperadmin = TFM_SuperadminList.isUserSuperadmin(p);
|
||||
|
||||
if (listFilter == ListFilter.SHOW_ADMINS && !userSuperadmin)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String prefix = "";
|
||||
|
||||
if (TFM_SuperadminList.isUserSuperadmin(p))
|
||||
if (userSuperadmin)
|
||||
{
|
||||
if (TFM_SuperadminList.isSeniorAdmin(p))
|
||||
{
|
||||
@ -66,7 +87,7 @@ public class Command_list extends TFM_Command
|
||||
player_names.add(prefix + p.getName() + ChatColor.WHITE);
|
||||
}
|
||||
|
||||
onlineUsers.append("Connected players: ").append(StringUtils.join(player_names, ", "));
|
||||
onlineUsers.append("Connected ").append(listFilter == ListFilter.SHOW_ADMINS ? "admins" : "players").append(": ").append(StringUtils.join(player_names, ", "));
|
||||
|
||||
if (senderIsConsole)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user