    001    package net.minecraft.src;
    002
    003    import java.util.List;
    004    import net.minecraft.server.MinecraftServer;
    005
    006    public class CommandServerKick extends CommandBase
    007    {
    008        public String getCommandName()
    009        {
    010            return "kick";
    011        }
    012
    013        public int func_82362_a()
    014        {
    015            return 3;
    016        }
    017
    018        public String getCommandUsage(ICommandSender par1ICommandSender)
    019        {
    020            return par1ICommandSender.translateString("commands.kick.usage", new Object[0]);
    021        }
    022
    023        public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    024        {
    025            if (par2ArrayOfStr.length > 0 && par2ArrayOfStr[0].length() > 1)
    026            {
    027                EntityPlayerMP var3 = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(par2ArrayOfStr[0]);
    028                String var4 = "Kicked by an operator.";
    029                boolean var5 = false;
    030
    031                if (var3 == null)
    032                {
    033                    throw new PlayerNotFoundException();
    034                }
    035                else
    036                {
    037                    if (par2ArrayOfStr.length >= 2)
    038                    {
    039                        var4 = func_82360_a(par1ICommandSender, par2ArrayOfStr, 1);
    040                        var5 = true;
    041                    }
    042
    043                    var3.playerNetServerHandler.kickPlayerFromServer(var4);
    044
    045                    if (var5)
    046                    {
    047                        notifyAdmins(par1ICommandSender, "commands.kick.success.reason", new Object[] {var3.getEntityName(), var4});
    048                    }
    049                    else
    050                    {
    051                        notifyAdmins(par1ICommandSender, "commands.kick.success", new Object[] {var3.getEntityName()});
    052                    }
    053                }
    054            }
    055            else
    056            {
    057                throw new WrongUsageException("commands.kick.usage", new Object[0]);
    058            }
    059        }
    060
    061        /**
    062         * Adds the strings available in this command to the given list of tab completion options.
    063         */
    064        public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    065        {
    066            return par2ArrayOfStr.length >= 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames()) : null;
    067        }
    068    }