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,19 +126,16 @@ 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;
} else {
this.replayGuiList.setDimensions(this.width, this.height, 32, this.height - 64);
}
if(fileReloader != null) fileReloader.stop(); new Thread(new Runnable() {
fileReloader = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
reloadFiles(); reloadFiles();
} }
}, "replay-viewer-file-reloader"); }, "replay-viewer-file-reloader").start();
fileReloader.start(); } else {
this.replayGuiList.setDimensions(this.width, this.height, 32, this.height - 64);
}
this.createButtons(); this.createButtons();
} }