Make sure the replay is stopped if the main menu is opened (fixes #95)
This commit is contained in:
@@ -16,6 +16,8 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.replaymod.replay.ReplayModReplay.LOGGER;
|
||||
|
||||
public class GuiHandler {
|
||||
private static final int BUTTON_EXIT_SERVER = 1;
|
||||
private static final int BUTTON_ACHIEVEMENTS = 5;
|
||||
@@ -102,6 +104,20 @@ public class GuiHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mod.getReplayHandler() != null) {
|
||||
// Something went terribly wrong and we ended up in the main menu with the replay still active.
|
||||
// To prevent players from joining live servers and using the CameraEntity, try to stop the replay now.
|
||||
try {
|
||||
mod.getReplayHandler().endReplay();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Trying to stop broken replay: ", e);
|
||||
} finally {
|
||||
if (mod.getReplayHandler() != null) {
|
||||
mod.forcefullyStopReplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<GuiButton> buttonList = event.buttonList;
|
||||
GuiButton button = new GuiButton(BUTTON_REPLAY_VIEWER, event.gui.width / 2 - 100,
|
||||
|
||||
Reference in New Issue
Block a user