diff --git a/src/main/java/net/minestom/server/storage/systems/FileStorageSystem.java b/src/main/java/net/minestom/server/storage/systems/FileStorageSystem.java index 98b226d46..29dd1bb1c 100644 --- a/src/main/java/net/minestom/server/storage/systems/FileStorageSystem.java +++ b/src/main/java/net/minestom/server/storage/systems/FileStorageSystem.java @@ -19,6 +19,8 @@ import java.nio.file.Paths; */ public class FileStorageSystem implements StorageSystem { + private Options options; + static { RocksDB.loadLibrary(); } @@ -32,11 +34,11 @@ public class FileStorageSystem implements StorageSystem { @Override public void open(@NotNull String location, @NotNull StorageOptions storageOptions) { - Options options = new Options().setCreateIfMissing(true); + options = new Options().setCreateIfMissing(true); if (storageOptions.hasCompression()) { options.setCompressionType(CompressionType.ZSTD_COMPRESSION); - options.setCompressionOptions(new CompressionOptions().setLevel(1)); + options.setCompressionOptions(new CompressionOptions().setLevel(4)); } try { @@ -78,6 +80,10 @@ public class FileStorageSystem implements StorageSystem { public void close() { try { this.rocksDB.closeE(); + + if (options != null) + this.options.close(); + } catch (RocksDBException e) { MinecraftServer.getExceptionManager().handleException(e); }