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