    001    package net.minecraft.src;
    002
    003    import java.util.Arrays;
    004    import java.util.List;
    005    import net.minecraft.server.MinecraftServer;
    006
    007    public class CommandServerMessage extends CommandBase
    008    {
    009        public List getCommandAliases()
    010        {
    011            return Arrays.asList(new String[] {"w", "msg"});
    012        }
    013
    014        public String getCommandName()
    015        {
    016            return "tell";
    017        }
    018
    019        public int func_82362_a()
    020        {
    021            return 0;
    022        }
    023
    024        public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    025        {
    026            if (par2ArrayOfStr.length < 2)
    027            {
    028                throw new WrongUsageException("commands.message.usage", new Object[0]);
    029            }
    030            else
    031            {
    032                EntityPlayerMP var3 = func_82359_c(par1ICommandSender, par2ArrayOfStr[0]);
    033
    034                if (var3 == null)
    035                {
    036                    throw new PlayerNotFoundException();
    037                }
    038                else if (var3 == par1ICommandSender)
    039                {
    040                    throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
    041                }
    042                else
    043                {
    044                    String var4 = func_82361_a(par1ICommandSender, par2ArrayOfStr, 1, !(par1ICommandSender instanceof EntityPlayer));
    045                    var3.sendChatToPlayer("\u00a77\u00a7o" + var3.translateString("commands.message.display.incoming", new Object[] {par1ICommandSender.getCommandSenderName(), var4}));
    046                    par1ICommandSender.sendChatToPlayer("\u00a77\u00a7o" + par1ICommandSender.translateString("commands.message.display.outgoing", new Object[] {var3.getCommandSenderName(), var4}));
    047                }
    048            }
    049        }
    050
    051        /**
    052         * Adds the strings available in this command to the given list of tab completion options.
    053         */
    054        public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    055        {
    056            return getListOfStringsMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames());
    057        }
    058
    059        public boolean func_82358_a(int par1)
    060        {
    061            return par1 == 0;
    062        }
    063    }