Merge branch '1.8.9-dev' into 1.9.4-dev

This commit is contained in:
Jonas Herzig
2018-01-16 22:09:50 +01:00
37 changed files with 757 additions and 44 deletions

View File

@@ -15,6 +15,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;
@@ -99,6 +101,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();
}
}
}
GuiButton button = new GuiButton(BUTTON_REPLAY_VIEWER, event.getGui().width / 2 - 100,
event.getGui().height / 4 + 10 + 3 * 24, I18n.format("replaymod.gui.replayviewer"));
button.width = button.width / 2 - 2;