package net.md_5.bungee.command;

import java.util.Collection;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.ChatColor;
import net.md_5.bungee.UserConnection;

/**
 * Command to list all players connected to the proxy.
 */
public class CommandList extends Command
{

    @Override
    public void execute(CommandSender sender, String[] args)
    {
        StringBuilder users = new StringBuilder();
        Collection<UserConnection> connections = BungeeCord.instance.connections.values();

        for (UserConnection con : connections)
        {
            switch (getPermission(con))
            {
                case ADMIN:
                    users.append(ChatColor.RED);
                    break;
                case MODERATOR:
                    users.append(ChatColor.GREEN);
                    break;
            }
            users.append(con.username);
            users.append(", ");
            users.append(ChatColor.RESET);
        }

        users.setLength(users.length() - 2);
        sender.sendMessage(ChatColor.BLUE + "Currently online across all servers (" + connections.size() + "): " + ChatColor.RESET + users);
    }
}

@@ -496,16 +496,167 @@
 ues();%0A%0A
+        if (connections.size() == 0) %7B%0A            sender.sendMessage(ChatColor.BLUE + %22Currently no players online.%22);%0A            return;%0A        %7D%0A%0A
         

Handle 0 online in list command. Fixes #32