3434import util .MCLogFile ;
3535import util .MCLogLine ;
3636import util .OSFileSystem ;
37+ import java .awt .Checkbox ;
3738
3839/**
3940 *
@@ -49,6 +50,7 @@ public class MainWindow extends JFrame {
4950 private JTextArea outputTextField ;
5051 private JScrollPane scrollPaneBottom ;
5152 private JTextArea statusTextField ;
53+ private Checkbox onlyChatCheckBox ;
5254 private Button defaultButton ;
5355 private Button addFoldersButton ;
5456 private JPanel panel_north ;
@@ -61,6 +63,7 @@ public class MainWindow extends JFrame {
6163
6264 private int tmpStauslength = 0 ;
6365 private JPanel panel_south ;
66+ private Component horizontalGlue_3 ;
6467
6568 /**
6669 * Create the frame.
@@ -97,6 +100,14 @@ public void actionPerformed(ActionEvent arg0) {
97100 panel_north .add (defaultButton );
98101 defaultButton .setForeground (Color .BLUE );
99102 defaultButton .setFont (new Font ("Consolas" , Font .PLAIN , 14 ));
103+
104+ horizontalGlue_3 = Box .createHorizontalGlue ();
105+ panel_north .add (horizontalGlue_3 );
106+
107+ onlyChatCheckBox = new Checkbox ("Only filter chat lines" );
108+ onlyChatCheckBox .setState (true );
109+ onlyChatCheckBox .setFont (new Font ("Consolas" , Font .PLAIN , 14 ));
110+ panel_north .add (onlyChatCheckBox );
100111
101112 horizontalGlue_2 = Box .createHorizontalGlue ();
102113 panel_north .add (horizontalGlue_2 );
@@ -138,7 +149,8 @@ public void run() {
138149 inputTextField .setWrapStyleWord (true );
139150 inputTextField .setRows (4 );
140151 inputTextField .setFont (new Font ("Consolas" , Font .PLAIN , 14 ));
141- inputTextField .setText ("(You bought Kismet Feather!.*)|(You purchased .*Kismet Feather .*)|(The Catacombs - Floor VII)->(Team Score: [0-9]+ \\ (S\\ +\\ ).*)" );
152+ inputTextField .setText (
153+ "(You bought Kismet Feather!.*)|(You purchased .*Kismet Feather .*)|(The Catacombs - Floor VII)->(Team Score: [0-9]+ \\ (S\\ +\\ ).*)" );
142154 inputTextField .setEditable (true );
143155 scrollPaneTop .setViewportView (inputTextField );
144156
@@ -162,7 +174,7 @@ public void run() {
162174 scrollPaneBottom .setViewportView (statusTextField );
163175 }
164176
165- private synchronized void analyze () {
177+ private synchronized void analyze (boolean onlyChat ) {
166178 try {
167179 OSFileSystem fileSystem = new OSFileSystem (mainWindow );
168180 ArrayList <File > minecraftLogFolders = fileSystem .lookForMinecraftLogFolders ();
@@ -203,7 +215,7 @@ public int compare(File f1, File f2) {
203215 addStatusTemporaryly (
204216 "INFO: Loading " + fileCount + " files - " + (counter * 100 / fileCount ) + "%" );
205217 try {
206- minecraftLogFile = new MCLogFile (logFile , getPreviousFileInFolder (counter , allFiles ));
218+ minecraftLogFile = new MCLogFile (logFile , getPreviousFileInFolder (counter , allFiles ), onlyChat );
207219 if (minecraftLogFile .getPlayerName () != null ) {
208220 lastLoginName = minecraftLogFile .getPlayerName ();
209221 playerNames .put (lastLoginName , playerNames .getOrDefault (lastLoginName , 0 ) + 1 );
@@ -275,7 +287,7 @@ private void startAnalysis() {
275287 Thread t0 = new Thread () {
276288 @ Override
277289 public void run () {
278- mainWindow .analyze ();
290+ mainWindow .analyze (onlyChatCheckBox . getState () );
279291 }
280292 };
281293 t0 .start ();
0 commit comments