    001    package net.minecraft.src;
    002
    003    import java.util.List;
    004    import net.minecraft.server.MinecraftServer;
    005
    006    public class CommandClearInventory extends CommandBase
    007    {
    008        public String getCommandName()
    009        {
    010            return "clear";
    011        }
    012
    013        public String getCommandUsage(ICommandSender par1ICommandSender)
    014        {
    015            return par1ICommandSender.translateString("commands.clear.usage", new Object[0]);
    016        }
    017
    018        public int func_82362_a()
    019        {
    020            return 2;
    021        }
    022
    023        public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    024        {
    025            EntityPlayerMP var3 = par2ArrayOfStr.length == 0 ? getCommandSenderAsPlayer(par1ICommandSender) : func_82359_c(par1ICommandSender, par2ArrayOfStr[0]);
    026            int var4 = par2ArrayOfStr.length >= 2 ? parseIntWithMin(par1ICommandSender, par2ArrayOfStr[1], 1) : -1;
    027            int var5 = par2ArrayOfStr.length >= 3 ? parseIntWithMin(par1ICommandSender, par2ArrayOfStr[2], 0) : -1;
    028            int var6 = var3.inventory.func_82347_b(var4, var5);
    029            var3.inventorySlots.updateCraftingResults();
    030            notifyAdmins(par1ICommandSender, "commands.clear.success", new Object[] {var3.getEntityName(), Integer.valueOf(var6)});
    031        }
    032
    033        /**
    034         * Adds the strings available in this command to the given list of tab completion options.
    035         */
    036        public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    037        {
    038            return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, this.func_82369_d()) : null;
    039        }
    040
    041        protected String[] func_82369_d()
    042        {
    043            return MinecraftServer.getServer().getAllUsernames();
    044        }
    045
    046        public boolean func_82358_a(int par1)
    047        {
    048            return par1 == 0;
    049        }
    050    }