summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2024-01-20 12:44:17 +0800
committerKeuin <[email protected]>2024-01-20 13:02:22 +0800
commit6d53613a57d542a424d6368cb91c69dfd5c6772e (patch)
tree640510455e37cc32064da5c495256b4c0f912744 /src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
parent6087003104bcc21a66bc3534b5606b999acf95db (diff)
add plugin-wide config; enable CoW through config file
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
index 362abb8..8b55d1e 100644
--- a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
+++ b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
@@ -2,6 +2,7 @@ package com.keuin.kbackupfabric;
import com.keuin.kbackupfabric.backup.BackupFilesystemUtil;
import com.keuin.kbackupfabric.backup.suggestion.BackupNameSuggestionProvider;
+import com.keuin.kbackupfabric.config.KBackupConfig;
import com.keuin.kbackupfabric.event.OnPlayerConnect;
import com.keuin.kbackupfabric.metadata.BackupMetadata;
import com.keuin.kbackupfabric.metadata.MetadataHolder;
@@ -29,10 +30,17 @@ import static org.apache.commons.io.FileUtils.forceDelete;
public final class KBPluginEvents implements ModInitializer {
//private static final Logger LOGGER = LogManager.getLogger();
-
@Override
public void onInitialize() {
- System.out.println("Binding events and commands ...");
+ PrintUtil.info("Reading config...");
+ try {
+ KBackupConfig.load();
+ } catch (IOException e) {
+ PrintUtil.error("Failed to read config file, using default values: " + e + e.getMessage());
+ }
+ boolean incCow = KBackupConfig.getInstance().getIncbakCow();
+ PrintUtil.info("Incremental backup CoW: " + (incCow ? "enabled" : "disabled"));
+ PrintUtil.info("Binding events and commands...");
CommandRegistrationCallback.EVENT.register(KBCommandsRegister::registerCommands);
OnPlayerConnect.ON_PLAYER_CONNECT.register((connection, player)
-> NotificationManager.INSTANCE.notifyPlayer(DistinctNotifiable.fromServerPlayerEntity(player)));