Shift ZSTD bindings check

This commit is contained in:
NotMyFault 2021-09-16 21:56:28 +02:00
parent 1dd0dac462
commit 9fb6ebe7ac
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 10 additions and 7 deletions

View File

@ -268,15 +268,16 @@ public class Fawe {
* - LocalSession supports VirtualPlayers and undo on disk * - LocalSession supports VirtualPlayers and undo on disk
*/ */
if (!Settings.IMP.EXPERIMENTAL.DISABLE_NATIVES) { 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 { try {
Native.load(); Native.load();
} catch (Throwable e) { } catch (Throwable e) {
if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL > 6 || Settings.IMP.HISTORY.COMPRESSION_LEVEL > 6) { LOGGER.error("ZSTD compression binding not found.\n"
Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL = Math.min(6, Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL); + "FAWE will still work but compression won't work as well.\n", e);
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);
}
} }
try { try {
net.jpountz.util.Native.load(); net.jpountz.util.Native.load();

View File

@ -224,10 +224,12 @@ public class Settings extends Config {
"4 = 1 x medium, 1 x fast", "4 = 1 x medium, 1 x fast",
"5 = 1 x medium, 2 x fast", "5 = 1 x medium, 2 x fast",
"6 = 1 x medium, 3 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", "7 = 1 x high, 1 x medium, 1 x fast",
"8 = 1 x high, 1 x medium, 2 x fast", "8 = 1 x high, 1 x medium, 2 x fast",
"9 = 1 x high, 1 x medium, 3 x fast (best compression)", "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" "NOTE: If using disk, do some compression (3+) as smaller files save faster"
*/
}) })
public int COMPRESSION_LEVEL = 3; public int COMPRESSION_LEVEL = 3;
@Comment({ @Comment({
@ -500,7 +502,7 @@ public class Settings extends Config {
" - TODO: Buffered random access with compression is not implemented on disk yet", " - TODO: Buffered random access with compression is not implemented on disk yet",
" - 0 = No compression", " - 0 = No compression",
" - 1 = Fast compression", " - 1 = Fast compression",
" - 2-17 = Slower compression" " - 2-6 = Slower compression"
}) })
public int COMPRESSION_LEVEL = 1; public int COMPRESSION_LEVEL = 1;
@Comment("Number of days to keep history on disk before deleting it") @Comment("Number of days to keep history on disk before deleting it")