Added mod version info to metadata
This commit is contained in:
parent
2efe112157
commit
86ae95b02e
@ -26,6 +26,8 @@ import net.fabricmc.api.ModInitializer;
|
|||||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
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.ServerLifecycleEvents;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
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.minecraft.server.command.ServerCommandSource;
|
||||||
import net.szum123321.textile_backup.commands.create.CleanupCommand;
|
import net.szum123321.textile_backup.commands.create.CleanupCommand;
|
||||||
import net.szum123321.textile_backup.commands.create.StartBackupCommand;
|
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 class TextileBackup implements ModInitializer {
|
||||||
public static final String MOD_NAME = "Textile Backup";
|
public static final String MOD_NAME = "Textile Backup";
|
||||||
public static final String MOD_ID = "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 TextileLogger log = new TextileLogger(MOD_NAME);
|
||||||
private final static ConfigHelper config = ConfigHelper.INSTANCE;
|
private final static ConfigHelper config = ConfigHelper.INSTANCE;
|
||||||
@ -105,4 +108,9 @@ public class TextileBackup implements ModInitializer {
|
|||||||
.then(KillRestoreCommand.register())
|
.then(KillRestoreCommand.register())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
VERSION = FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow().getMetadata().getVersion();
|
||||||
|
FabricLoader.getInstance().getModContainer("minecraft").orElseThrow().getMetadata().getVersion();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
package net.szum123321.textile_backup.core;
|
package net.szum123321.textile_backup.core;
|
||||||
|
|
||||||
|
import net.fabricmc.loader.api.Version;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@ -25,7 +27,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public record CompressionStatus(long treeHash, LocalDateTime date, long startTimestamp, long finishTimestamp, Map<Path, Exception> brokenFiles) implements Serializable {
|
public record CompressionStatus(long treeHash, Map<Path, Exception> brokenFiles, LocalDateTime date, long startTimestamp, long finishTimestamp, Version modVersion) implements Serializable {
|
||||||
public static final String DATA_FILENAME = "textile_status.data";
|
public static final String DATA_FILENAME = "textile_status.data";
|
||||||
public boolean isValid(long decompressedHash) {
|
public boolean isValid(long decompressedHash) {
|
||||||
return decompressedHash == treeHash;
|
return decompressedHash == treeHash;
|
||||||
@ -54,7 +56,8 @@ public record CompressionStatus(long treeHash, LocalDateTime date, long startTim
|
|||||||
.append(", Date: ")
|
.append(", Date: ")
|
||||||
.append(date.format(DateTimeFormatter.ISO_DATE_TIME))
|
.append(date.format(DateTimeFormatter.ISO_DATE_TIME))
|
||||||
.append(", start time stamp: ").append(startTimestamp)
|
.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: ");
|
builder.append(", broken files: ");
|
||||||
if(brokenFiles.isEmpty()) builder.append("[]");
|
if(brokenFiles.isEmpty()) builder.append("[]");
|
||||||
|
Loading…
Reference in New Issue
Block a user