diff options
author | Keuin <[email protected]> | 2021-01-25 15:25:34 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2021-01-25 15:25:34 +0800 |
commit | 08ac6aaea58b7309ea95a12ca6227a6ca3ce4db5 (patch) | |
tree | d305fc23d2cec9935ccb5e5a5390c9d5e54a8726 /src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java | |
parent | a817715ad4f625e355b285d67ee323e8b2006ae4 (diff) |
Improve user interaction.
Code refactor.
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java index e1d5cbd..8992d17 100644 --- a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java +++ b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java @@ -4,6 +4,8 @@ import com.keuin.kbackupfabric.backup.BackupFilesystemUtil; import com.keuin.kbackupfabric.backup.suggestion.BackupNameSuggestionProvider; import com.keuin.kbackupfabric.metadata.BackupMetadata; import com.keuin.kbackupfabric.metadata.MetadataHolder; +import com.keuin.kbackupfabric.ui.KBCommands; +import com.keuin.kbackupfabric.util.DateUtil; import com.keuin.kbackupfabric.util.PrintUtil; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.server.ServerStartCallback; @@ -15,8 +17,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; -import java.text.SimpleDateFormat; -import java.util.Date; import static org.apache.commons.io.FileUtils.forceDelete; @@ -39,11 +39,14 @@ public final class KBPluginEvents implements ModInitializer, ServerStartCallback public void onStartServer(MinecraftServer server) { if (!(server instanceof MinecraftDedicatedServer)) - throw new RuntimeException("KBackup is a server-side-only plugin. Please do not use it in Minecraft client."); + throw new RuntimeException("KBackup is a server-side-only plugin. Please do not use it in client-side."); // Initialize player manager reference PrintUtil.setPlayerManager(server.getPlayerManager()); + // Initialize backup manager server reference + KBCommands.setServer(server); + // Update backup suggestion list BackupNameSuggestionProvider.setBackupSaveDirectory(BackupFilesystemUtil.getBackupSaveDirectory(server).getPath()); @@ -64,7 +67,7 @@ public final class KBPluginEvents implements ModInitializer, ServerStartCallback MetadataHolder.setMetadata(metadata); PrintUtil.info("Restored world from a previous backup:"); PrintUtil.info("Backup Name: " + metadata.getBackupName()); - PrintUtil.info("Create Time: " + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date(metadata.getBackupTime()))); + PrintUtil.info("Create Time: " + DateUtil.fromEpochMillis(metadata.getBackupTime())); // Delete metadata file if (!metadataFile.delete()) { |