Prevent overlay from being closed during path preview

Update jGui
This commit is contained in:
johni0702
2016-08-16 13:48:45 +02:00
parent c8c301430e
commit fe8571712d
2 changed files with 17 additions and 2 deletions

2
jGui

Submodule jGui updated: 95d9d873fb...f135e29849

View File

@@ -2,6 +2,7 @@ package com.replaymod.simplepathing.gui;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.replaymod.core.ReplayMod;
import com.replaymod.pathing.gui.GuiKeyframeRepository;
@@ -229,7 +230,21 @@ public class GuiPathing {
preparePathsForPlayback();
timePath.setActive(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT));
player.start(timeline);
ListenableFuture<Void> future = player.start(timeline);
overlay.setCloseable(false);
overlay.setMouseVisible(true);
Futures.addCallback(future, new FutureCallback<Void>() {
@Override
public void onSuccess(@Nullable Void result) {
overlay.setCloseable(true);
}
@Override
public void onFailure(Throwable t) {
t.printStackTrace();
overlay.setCloseable(true);
}
});
}
}
});