001package net.minecraft.network.rcon;
002
003import net.minecraft.command.ICommandSender;
004import net.minecraft.util.ChunkCoordinates;
005import net.minecraft.util.StringTranslate;
006
007public class RConConsoleSource implements ICommandSender
008{
009    /** only ever used by MinecraftServer.executeCommand */
010    public static final RConConsoleSource consoleBuffer = new RConConsoleSource();
011
012    /** RCon string buffer for log. */
013    private StringBuffer buffer = new StringBuffer();
014
015    /**
016     * Clears the RCon log
017     */
018    public void resetLog()
019    {
020        this.buffer.setLength(0);
021    }
022
023    public String getChatBuffer()
024    {
025        return this.buffer.toString();
026    }
027
028    /**
029     * Gets the name of this command sender (usually username, but possibly "Rcon")
030     */
031    public String getCommandSenderName()
032    {
033        return "Rcon";
034    }
035
036    public void sendChatToPlayer(String par1Str)
037    {
038        this.buffer.append(par1Str);
039    }
040
041    /**
042     * Returns true if the command sender is allowed to use the given command.
043     */
044    public boolean canCommandSenderUseCommand(int par1, String par2Str)
045    {
046        return true;
047    }
048
049    /**
050     * Translates and formats the given string key with the given arguments.
051     */
052    public String translateString(String par1Str, Object ... par2ArrayOfObj)
053    {
054        return StringTranslate.getInstance().translateKeyFormat(par1Str, par2ArrayOfObj);
055    }
056
057    /**
058     * Return the position for this command sender.
059     */
060    public ChunkCoordinates getPlayerCoordinates()
061    {
062        return new ChunkCoordinates(0, 0, 0);
063    }
064}