Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 40 lines 978 B view raw
1package net.minecraft.server; 2 3import javax.swing.*; 4import java.util.logging.Formatter; 5import java.util.logging.Handler; 6import java.util.logging.LogRecord; 7 8public class GuiLogOutputHandler extends Handler { 9 10 private int[] b = new int[1024]; 11 private int c = 0; 12 Formatter a = new GuiLogFormatter(this); 13 private JTextArea d; 14 15 public GuiLogOutputHandler(JTextArea jtextarea) { 16 this.setFormatter(this.a); 17 this.d = jtextarea; 18 } 19 20 public void close() { 21 } 22 23 public void flush() { 24 } 25 26 public void publish(LogRecord logrecord) { 27 int i = this.d.getDocument().getLength(); 28 29 this.d.append(this.a.format(logrecord)); 30 this.d.setCaretPosition(this.d.getDocument().getLength()); 31 int j = this.d.getDocument().getLength() - i; 32 33 if (this.b[this.c] != 0) { 34 this.d.replaceRange("", 0, this.b[this.c]); 35 } 36 37 this.b[this.c] = j; 38 this.c = (this.c + 1) % 1024; 39 } 40}