From fb3c8cc5e12e4c9d2fe3eb6dc7d354fb54e8ada7 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 2 Aug 2017 13:20:47 +1000 Subject: [PATCH] Only resize if expanding --- .../fawe/object/clipboard/DiskOptimizedClipboard.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java b/core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java index e4fbdfb8..2262fba2 100644 --- a/core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java +++ b/core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java @@ -238,10 +238,12 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable { area = width * length; volume = width * length * height; long size = width * height * length * 2l + HEADER_SIZE + (hasBiomes() ? area : 0); - close(); - this.braf = new RandomAccessFile(file, "rw"); - braf.setLength(size); - init(); + if (braf.length() < size) { + close(); + this.braf = new RandomAccessFile(file, "rw"); + braf.setLength(size); + init(); + } mbb.putChar(2, (char) width); mbb.putChar(4, (char) height); mbb.putChar(6, (char) length);