    001    package net.minecraft.command;
    002
    003    import java.util.List;
    004    import net.minecraft.network.packet.Packet3Chat;
    005    import net.minecraft.server.MinecraftServer;
    006
    007    public class CommandServerSay extends CommandBase
    008    {
    009        public String getCommandName()
    010        {
    011            return "say";
    012        }
    013
    014        /**
    015         * Return the required permission level for this command.
    016         */
    017        public int getRequiredPermissionLevel()
    018        {
    019            return 1;
    020        }
    021
    022        public String getCommandUsage(ICommandSender par1ICommandSender)
    023        {
    024            return par1ICommandSender.translateString("commands.say.usage", new Object[0]);
    025        }
    026
    027        public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    028        {
    029            if (par2ArrayOfStr.length > 0 && par2ArrayOfStr[0].length() > 0)
    030            {
    031                String var3 = func_82361_a(par1ICommandSender, par2ArrayOfStr, 0, true);
    032                MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new Packet3Chat(String.format("[%s] %s", new Object[] {par1ICommandSender.getCommandSenderName(), var3})));
    033            }
    034            else
    035            {
    036                throw new WrongUsageException("commands.say.usage", new Object[0]);
    037            }
    038        }
    039
    040        /**
    041         * Adds the strings available in this command to the given list of tab completion options.
    042         */
    043        public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    044        {
    045            return par2ArrayOfStr.length >= 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames()) : null;
    046        }
    047    }