diff options
author | Keuin <[email protected]> | 2020-04-23 20:57:17 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2020-04-23 20:57:17 +0800 |
commit | f7f918f19b5d0597d21f03b7085425c3a93cc5f6 (patch) | |
tree | b23b3985d48651043bf4780090a777182a2ea76c /src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java | |
parent | ba19ab350516e26a8e52cc217878bde63c0b7eee (diff) |
Added backup name completion.
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java index 4f0f1ff..a1ffcad 100644 --- a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java +++ b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java @@ -1,6 +1,8 @@ package com.keuin.kbackupfabric; import com.keuin.kbackupfabric.data.BackupMetadata; +import com.keuin.kbackupfabric.util.BackupFilesystemUtil; +import com.keuin.kbackupfabric.util.BackupNameSuggestionProvider; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.server.ServerStartCallback; import net.fabricmc.fabric.api.registry.CommandRegistry; @@ -24,18 +26,19 @@ import static org.apache.commons.io.FileUtils.forceDelete; public final class KBPluginEvents implements ModInitializer, ServerStartCallback { @Override public void onInitialize() { - System.out.println("Initializing KBackup..."); - CommandRegistry.INSTANCE.register(false, KBRegister::registerCommands); + System.out.println("KBackup: Binding events and commands ..."); + CommandRegistry.INSTANCE.register(false, KBCommandRegister::registerCommands); ServerStartCallback.EVENT.register(this); } @Override public void onStartServer(MinecraftServer server) { - // When the server starts, we check if we have just recovered from a backup. - // If so, then we print some message. - debug("KBackup onStartServer"); - // TODO: - // Check + debug("KBackup: Initializing ..."); + + // Update backup suggestion list + BackupNameSuggestionProvider.setBackupSaveDirectory(BackupFilesystemUtil.getBackupSaveDirectory(server).getPath()); + + // Check if we have just recovered from a previous backup. If so, print message. try { File levelDirectory = new File(server.getRunDirectory(), server.getLevelName()); File metadataFile = new File(levelDirectory, BackupMetadata.metadataFileName); |