001    package net.minecraft.src;
002    
003    public class RConConsoleSource implements ICommandSender
004    {
005        /** only ever used by MinecraftServer.executeCommand */
006        public static final RConConsoleSource consoleBuffer = new RConConsoleSource();
007        private StringBuffer chatBuffer = new StringBuffer();
008    
009        public void clearChatBuffer()
010        {
011            this.chatBuffer.setLength(0);
012        }
013    
014        public String getChatBuffer()
015        {
016            return this.chatBuffer.toString();
017        }
018    
019        /**
020         * Gets the name of this command sender (usually username, but possibly "Rcon")
021         */
022        public String getCommandSenderName()
023        {
024            return "Rcon";
025        }
026    
027        public void sendChatToPlayer(String par1Str)
028        {
029            this.chatBuffer.append(par1Str);
030        }
031    
032        /**
033         * Returns true if the command sender is allowed to use the given command.
034         */
035        public boolean canCommandSenderUseCommand(String par1Str)
036        {
037            return true;
038        }
039    
040        /**
041         * Translates and formats the given string key with the given arguments.
042         */
043        public String translateString(String par1Str, Object ... par2ArrayOfObj)
044        {
045            return StringTranslate.getInstance().translateKeyFormat(par1Str, par2ArrayOfObj);
046        }
047    }