mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 21:56:33 +01:00
Fix error from flushing on different thread
This commit is contained in:
parent
d4fd374caa
commit
d61c21f60e
@ -134,6 +134,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
||||
|
||||
@Override
|
||||
public boolean flush() {
|
||||
synchronized (this) {
|
||||
super.flush();
|
||||
boolean flushed = osBD != null || osNBTF != null || osNBTT != null && osENTCF != null || osENTCT != null;
|
||||
try {
|
||||
@ -162,6 +163,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
||||
}
|
||||
return flushed;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCompressedSize() {
|
||||
@ -199,12 +201,14 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
||||
if (osBD != null) {
|
||||
return osBD;
|
||||
}
|
||||
synchronized (this) {
|
||||
bdFile.getParentFile().mkdirs();
|
||||
bdFile.createNewFile();
|
||||
osBD = getCompressedOS(new FileOutputStream(bdFile));
|
||||
writeHeader(osBD, x, y, z);
|
||||
return osBD;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTOutputStream getEntityCreateOS() throws IOException {
|
||||
|
@ -48,6 +48,7 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
||||
|
||||
@Override
|
||||
public boolean flush() {
|
||||
synchronized (this) {
|
||||
super.flush();
|
||||
try {
|
||||
if (idsStream != null) {
|
||||
@ -85,6 +86,7 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
||||
} catch (IOException e) {
|
||||
MainUtil.handleError(e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -110,12 +112,14 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
||||
if (idsStreamZip != null) {
|
||||
return idsStreamZip;
|
||||
}
|
||||
synchronized (this) {
|
||||
setOrigin(x, z);
|
||||
idsStream = new FastByteArrayOutputStream(Settings.HISTORY.BUFFER_SIZE);
|
||||
idsStreamZip = getCompressedOS(idsStream);
|
||||
writeHeader(idsStreamZip, x, y, z);
|
||||
return idsStreamZip;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getBlockIS() throws IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user