Log when replays are opened (closes #565)
This commit is contained in:
@@ -56,11 +56,16 @@ public class RestoreReplayGui extends AbstractGuiScreen<RestoreReplayGui> {
|
||||
new GuiLabel().setI18nText("replaymod.gui.restorereplay1"),
|
||||
new GuiLabel().setI18nText("replaymod.gui.restorereplay2", Files.getNameWithoutExtension(file.getName())),
|
||||
new GuiLabel().setI18nText("replaymod.gui.restorereplay3"));
|
||||
|
||||
LOGGER.info("Found partially saved replay, offering recovery: " + file);
|
||||
|
||||
yesButton.onClick(() -> {
|
||||
LOGGER.info("Attempting recovery: " + file);
|
||||
recoverInBackground();
|
||||
parent.display();
|
||||
});
|
||||
noButton.onClick(() -> {
|
||||
LOGGER.info("Recovery rejected, marking for deletion: " + file);
|
||||
try {
|
||||
File tmp = new File(file.getParentFile(), file.getName() + ".tmp");
|
||||
File deleted = new File(file.getParentFile(), file.getName() + ".del");
|
||||
|
||||
@@ -21,6 +21,8 @@ import de.johni0702.minecraft.gui.popup.AbstractGuiPopup;
|
||||
import de.johni0702.minecraft.gui.utils.lwjgl.Color;
|
||||
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
|
||||
import net.minecraft.util.crash.CrashReport;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
@@ -31,6 +33,8 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GuiEditReplay extends AbstractGuiPopup<GuiEditReplay> {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
private final Path inputPath;
|
||||
|
||||
private final EditTimeline timeline;
|
||||
@@ -60,6 +64,8 @@ public class GuiEditReplay extends AbstractGuiPopup<GuiEditReplay> {
|
||||
super(container);
|
||||
this.inputPath = inputPath;
|
||||
|
||||
LOGGER.info("Opening replay in editor: " + inputPath);
|
||||
|
||||
try (ReplayFile replayFile = ReplayMod.instance.files.open(inputPath)) {
|
||||
markers = replayFile.getMarkers().or(HashSet::new);
|
||||
timeline = new EditTimeline(new HashSet<>(markers), markers -> this.markers = markers);
|
||||
|
||||
@@ -95,8 +95,10 @@ public class GuiReplayViewer extends GuiScreen {
|
||||
|
||||
List<GuiReplayEntry> selected = list.getSelected();
|
||||
if (selected.size() == 1) {
|
||||
File file = selected.get(0).file;
|
||||
LOGGER.info("Opening replay in viewer: " + file);
|
||||
try {
|
||||
mod.startReplay(selected.get(0).file);
|
||||
mod.startReplay(file);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user