From abc047c9d6641b692e7a3e9d52e44c224f4ddfca Mon Sep 17 00:00:00 2001 From: szymon Date: Tue, 4 Aug 2020 17:32:11 +0200 Subject: [PATCH] Config prearrangement + removed option to disable logging. (Why was that there in the first place?) --- .../textile_backup/ConfigHandler.java | 31 +++++++++---------- .../textile_backup/core/Utilities.java | 3 +- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/main/java/net/szum123321/textile_backup/ConfigHandler.java b/src/main/java/net/szum123321/textile_backup/ConfigHandler.java index 8aacbf2..eece7c1 100644 --- a/src/main/java/net/szum123321/textile_backup/ConfigHandler.java +++ b/src/main/java/net/szum123321/textile_backup/ConfigHandler.java @@ -32,22 +32,28 @@ public class ConfigHandler { "When set to 0 backups will not be performed automatically\n") public long backupInterval = 3600; + @Comment("\nDelay in seconds between typing-in /backup restore and it actually starting\n") + public int restoreDelay = 30; + @Comment("\nShould backups be done even if there are no players?\n") public boolean doBackupsOnEmptyServer = false; @Comment("\nShould backup be made on server shutdown?\n") public boolean shutdownBackup = true; + @Comment("\nShould old world be backed-up?\n") + public boolean backupOldWorlds = true; + + @Comment("\nShould every world has its won backup folder?\n") + public boolean perWorldBackup = true; + @Comment("\nA path to backup folder\n") public String path = "backup/"; - @Comment("\nThis setting allows you to exclude files form being backuped.\n"+ + @Comment("\nThis setting allows you to exclude files form being backedup.\n"+ "Be very careful when setting it, as it is easy corrupt your world!\n") public Set fileBlacklist = new HashSet<>(); - @Comment("\nShould every world has its won backup folder?\n") - public boolean perWorldBackup = false; - @Comment("\nMaximum number of backups to keep. If set to 0 then no backup will be deleted based their amount\n") public int backupsToKeep = 10; @@ -59,7 +65,10 @@ public class ConfigHandler { public int maxSize = 0; @Comment("\nCompression level \n0 - 9\n Only affects zip compression.\n") - public int compression = 6; + public int compression = 7; + + @Comment("\nLimit how many cores can be used for compression.\n") + public int compressionCoreCountLimit = 0; @Comment(value = "\nAvailable formats are:\n" + "ZIP - normal zip archive using standard deflate compression\n" + @@ -68,12 +77,6 @@ public class ConfigHandler { "LZMA - tar.xz using lzma compression\n") public ArchiveFormat format = ArchiveFormat.ZIP; - @Comment("\nLimit how many cores can be used for compression.\n") - public int compressionCoreCountLimit = 0; - - @Comment("\nPrint info to game out\n") - public boolean log = true; - @Comment("\nMinimal permission level required to run commands\n") public int permissionLevel = 4; @@ -92,12 +95,6 @@ public class ConfigHandler { "For more info: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html\n") public String dateTimeFormat = "dd.MM.yyyy_HH-mm-ss"; - @Comment("\nShould old world be backed-up?\n") - public boolean backupOldWorlds = true; - - @Comment("\nDelay between typing-in /backup restore and it actually starting\n") - public int restoreDelay = 30; - public Optional sanitize() { if(compressionCoreCountLimit > Runtime.getRuntime().availableProcessors()) return Optional.of("compressionCoreCountLimit is too big! Your system only has: " + Runtime.getRuntime().availableProcessors() + " cores!"); diff --git a/src/main/java/net/szum123321/textile_backup/core/Utilities.java b/src/main/java/net/szum123321/textile_backup/core/Utilities.java index 007a1be..8600d62 100644 --- a/src/main/java/net/szum123321/textile_backup/core/Utilities.java +++ b/src/main/java/net/szum123321/textile_backup/core/Utilities.java @@ -182,8 +182,7 @@ public class Utilities { if(ctx != null && ctx.getEntity() != null) ctx.sendFeedback(new LiteralText(s), false); - if(TextileBackup.CONFIG.log) - TextileBackup.LOGGER.info(s); + TextileBackup.LOGGER.info(s); } public static void sendError(String message, ServerCommandSource source) {