    001    package net.minecraft.src;
    002
    003    import java.util.List;
    004    import net.minecraft.server.MinecraftServer;
    005
    006    public class CommandServerBanlist extends CommandBase
    007    {
    008        public String getCommandName()
    009        {
    010            return "banlist";
    011        }
    012
    013        public int func_82362_a()
    014        {
    015            return 3;
    016        }
    017
    018        /**
    019         * Returns true if the given command sender is allowed to use this command.
    020         */
    021        public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender)
    022        {
    023            return (MinecraftServer.getServer().getConfigurationManager().getBannedIPs().isListActive() || MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().isListActive()) && super.canCommandSenderUseCommand(par1ICommandSender);
    024        }
    025
    026        public String getCommandUsage(ICommandSender par1ICommandSender)
    027        {
    028            return par1ICommandSender.translateString("commands.banlist.usage", new Object[0]);
    029        }
    030
    031        public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    032        {
    033            if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr[0].equalsIgnoreCase("ips"))
    034            {
    035                par1ICommandSender.sendChatToPlayer(par1ICommandSender.translateString("commands.banlist.ips", new Object[] {Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getBannedList().size())}));
    036                par1ICommandSender.sendChatToPlayer(joinNiceString(MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getBannedList().keySet().toArray()));
    037            }
    038            else
    039            {
    040                par1ICommandSender.sendChatToPlayer(par1ICommandSender.translateString("commands.banlist.players", new Object[] {Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getBannedList().size())}));
    041                par1ICommandSender.sendChatToPlayer(joinNiceString(MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getBannedList().keySet().toArray()));
    042            }
    043        }
    044
    045        /**
    046         * Adds the strings available in this command to the given list of tab completion options.
    047         */
    048        public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    049        {
    050            return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, new String[] {"players", "ips"}): null;
    051        }
    052    }