From 9fb6ebe7ac5d312f1c230ca0478318765b9d8258 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 16 Sep 2021 21:56:28 +0200 Subject: [PATCH] Shift ZSTD bindings check --- .../main/java/com/fastasyncworldedit/core/Fawe.java | 13 +++++++------ .../core/configuration/Settings.java | 4 +++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java index 473e20837..b2d7eccbc 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java @@ -268,15 +268,16 @@ public class Fawe { * - LocalSession supports VirtualPlayers and undo on disk */ if (!Settings.IMP.EXPERIMENTAL.DISABLE_NATIVES) { + // A higher amount is currently not supported by ZSTD / ZSTD JNI + if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL > 6 || Settings.IMP.HISTORY.COMPRESSION_LEVEL > 6) { + Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL = Math.min(6, Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL); + Settings.IMP.HISTORY.COMPRESSION_LEVEL = Math.min(6, Settings.IMP.HISTORY.COMPRESSION_LEVEL); + } try { Native.load(); } catch (Throwable e) { - if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL > 6 || Settings.IMP.HISTORY.COMPRESSION_LEVEL > 6) { - Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL = Math.min(6, Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL); - Settings.IMP.HISTORY.COMPRESSION_LEVEL = Math.min(6, Settings.IMP.HISTORY.COMPRESSION_LEVEL); - LOGGER.error("ZSTD Compression Binding Not Found.\n" - + "FAWE will still work but compression won't work as well.\n", e); - } + LOGGER.error("ZSTD compression binding not found.\n" + + "FAWE will still work but compression won't work as well.\n", e); } try { net.jpountz.util.Native.load(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index 69dfa12f7..969fb26fa 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -224,10 +224,12 @@ public class Settings extends Config { "4 = 1 x medium, 1 x fast", "5 = 1 x medium, 2 x fast", "6 = 1 x medium, 3 x fast", + /* A higher value is currently not supported by ZSTD / ZSTD-JNI "7 = 1 x high, 1 x medium, 1 x fast", "8 = 1 x high, 1 x medium, 2 x fast", "9 = 1 x high, 1 x medium, 3 x fast (best compression)", "NOTE: If using disk, do some compression (3+) as smaller files save faster" + */ }) public int COMPRESSION_LEVEL = 3; @Comment({ @@ -500,7 +502,7 @@ public class Settings extends Config { " - TODO: Buffered random access with compression is not implemented on disk yet", " - 0 = No compression", " - 1 = Fast compression", - " - 2-17 = Slower compression" + " - 2-6 = Slower compression" }) public int COMPRESSION_LEVEL = 1; @Comment("Number of days to keep history on disk before deleting it")