    001    package net.minecraft.server.gui;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.util.logging.Formatter;
    006    import java.util.logging.Handler;
    007    import java.util.logging.LogRecord;
    008    import javax.swing.JTextArea;
    009
    010    @SideOnly(Side.SERVER)
    011    public class GuiLogOutputHandler extends Handler
    012    {
    013        private int[] field_79023_b = new int[1024];
    014        private int field_79024_c = 0;
    015        Formatter field_79025_a = new GuiLogFormatter(this);
    016        private JTextArea field_79022_d;
    017
    018        public GuiLogOutputHandler(JTextArea par1JTextArea)
    019        {
    020            this.setFormatter(this.field_79025_a);
    021            this.field_79022_d = par1JTextArea;
    022        }
    023
    024        public void close() {}
    025
    026        public void flush() {}
    027
    028        public void publish(LogRecord par1LogRecord)
    029        {
    030            int var2 = this.field_79022_d.getDocument().getLength();
    031            this.field_79022_d.append(this.field_79025_a.format(par1LogRecord));
    032            this.field_79022_d.setCaretPosition(this.field_79022_d.getDocument().getLength());
    033            int var3 = this.field_79022_d.getDocument().getLength() - var2;
    034
    035            if (this.field_79023_b[this.field_79024_c] != 0)
    036            {
    037                this.field_79022_d.replaceRange("", 0, this.field_79023_b[this.field_79024_c]);
    038            }
    039
    040            this.field_79023_b[this.field_79024_c] = var3;
    041            this.field_79024_c = (this.field_79024_c + 1) % 1024;
    042        }
    043    }