diff --git a/src/main/java/net/szum123321/textile_backup/TextileBackup.java b/src/main/java/net/szum123321/textile_backup/TextileBackup.java index d2625db..4376430 100644 --- a/src/main/java/net/szum123321/textile_backup/TextileBackup.java +++ b/src/main/java/net/szum123321/textile_backup/TextileBackup.java @@ -26,6 +26,8 @@ import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.Version; import net.minecraft.server.command.ServerCommandSource; import net.szum123321.textile_backup.commands.create.CleanupCommand; import net.szum123321.textile_backup.commands.create.StartBackupCommand; @@ -45,6 +47,7 @@ import net.szum123321.textile_backup.core.create.MakeBackupRunnableFactory; public class TextileBackup implements ModInitializer { public static final String MOD_NAME = "Textile Backup"; public static final String MOD_ID = "textile_backup"; + public static final Version VERSION; private final static TextileLogger log = new TextileLogger(MOD_NAME); private final static ConfigHelper config = ConfigHelper.INSTANCE; @@ -105,4 +108,9 @@ public class TextileBackup implements ModInitializer { .then(KillRestoreCommand.register()) )); } + + static { + VERSION = FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow().getMetadata().getVersion(); + FabricLoader.getInstance().getModContainer("minecraft").orElseThrow().getMetadata().getVersion(); + } } diff --git a/src/main/java/net/szum123321/textile_backup/core/CompressionStatus.java b/src/main/java/net/szum123321/textile_backup/core/CompressionStatus.java index 022c880..e4a723a 100644 --- a/src/main/java/net/szum123321/textile_backup/core/CompressionStatus.java +++ b/src/main/java/net/szum123321/textile_backup/core/CompressionStatus.java @@ -18,6 +18,8 @@ package net.szum123321.textile_backup.core; +import net.fabricmc.loader.api.Version; + import java.io.*; import java.nio.file.Files; import java.nio.file.Path; @@ -25,7 +27,7 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Map; -public record CompressionStatus(long treeHash, LocalDateTime date, long startTimestamp, long finishTimestamp, Map brokenFiles) implements Serializable { +public record CompressionStatus(long treeHash, Map brokenFiles, LocalDateTime date, long startTimestamp, long finishTimestamp, Version modVersion) implements Serializable { public static final String DATA_FILENAME = "textile_status.data"; public boolean isValid(long decompressedHash) { return decompressedHash == treeHash; @@ -54,7 +56,8 @@ public record CompressionStatus(long treeHash, LocalDateTime date, long startTim .append(", Date: ") .append(date.format(DateTimeFormatter.ISO_DATE_TIME)) .append(", start time stamp: ").append(startTimestamp) - .append(", finish time stamp: ").append(finishTimestamp); + .append(", finish time stamp: ").append(finishTimestamp) + .append(", Mod Version:").append(modVersion.getFriendlyString()); builder.append(", broken files: "); if(brokenFiles.isEmpty()) builder.append("[]");