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