Fix DiskOptimisedClipboard not closing

This commit is contained in:
dordsor21 2020-03-30 17:00:41 +01:00
parent 76efbed4b2
commit 3cd30ebbff
2 changed files with 5 additions and 3 deletions

View File

@ -10,7 +10,6 @@ import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
@ -99,7 +98,6 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
} catch (Exception e) {
e.printStackTrace();
}
log.warn("Creating new RandomAccessFile: " + file.getPath());
this.braf = new RandomAccessFile(file, "rw");
long fileLength = (long) getVolume() * 2L + (long) HEADER_SIZE;
braf.setLength(0);
@ -286,7 +284,6 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
if (byteBuffer != null) {
byteBuffer.force();
fileChannel.close();
log.warn("Closing the RandomAccessFile: " + file.getPath());
braf.close();
//noinspection ResultOfMethodCallIgnored
file.setWritable(true);

View File

@ -271,6 +271,11 @@ public class BlockArrayClipboard implements Clipboard {
return parent;
}
@Override
public void close() {
this.parent.close();
}
/**
* Stores entity data.
*/