Only load Replay Files once in Replay Viewer to prevent the loader Thread from clashing with itself

This commit is contained in:
CrushedPixel
2015-07-04 22:24:09 +02:00
parent 434238c61d
commit c7bb053566

View File

@@ -118,8 +118,6 @@ public class GuiReplayViewer extends GuiScreen implements GuiYesNoCallback {
super.onGuiClosed(); super.onGuiClosed();
} }
private Thread fileReloader;
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void initGui() { public void initGui() {
@@ -128,20 +126,17 @@ public class GuiReplayViewer extends GuiScreen implements GuiYesNoCallback {
if(!this.initialized) { if(!this.initialized) {
replayGuiList = new ReplayList(this, this.mc, this.width, this.height, 32, this.height - 64, 36); replayGuiList = new ReplayList(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
this.initialized = true; this.initialized = true;
new Thread(new Runnable() {
@Override
public void run() {
reloadFiles();
}
}, "replay-viewer-file-reloader").start();
} else { } else {
this.replayGuiList.setDimensions(this.width, this.height, 32, this.height - 64); this.replayGuiList.setDimensions(this.width, this.height, 32, this.height - 64);
} }
if(fileReloader != null) fileReloader.stop();
fileReloader = new Thread(new Runnable() {
@Override
public void run() {
reloadFiles();
}
}, "replay-viewer-file-reloader");
fileReloader.start();
this.createButtons(); this.createButtons();
} }