Also synchronise when loading sections forcefully

This commit is contained in:
dordsor21 2021-06-12 15:09:02 +01:00
parent 8836d1d75c
commit d015e6b270
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
4 changed files with 12 additions and 32 deletions

View File

@ -816,17 +816,12 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
}
public ChunkSection[] getSections(boolean force) {
if (force && forceLoadSections) {
ChunkSection[] sections = getChunk().getSections();
ChunkSection[] copy = new ChunkSection[sections.length];
System.arraycopy(sections, 0, copy, 0, sections.length);
return copy;
}
force &= forceLoadSections;
ChunkSection[] tmp = sections;
if (tmp == null) {
if (tmp == null || force) {
synchronized (this) {
tmp = sections;
if (tmp == null) {
if (tmp == null || force) {
ChunkSection[] chunkSections = getChunk().getSections();
tmp = new ChunkSection[chunkSections.length];
System.arraycopy(chunkSections, 0, tmp, 0, chunkSections.length);

View File

@ -817,17 +817,12 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
}
public ChunkSection[] getSections(boolean force) {
if (force && forceLoadSections) {
ChunkSection[] sections = getChunk().getSections();
ChunkSection[] copy = new ChunkSection[sections.length];
System.arraycopy(sections, 0, copy, 0, sections.length);
return copy;
}
force &= forceLoadSections;
ChunkSection[] tmp = sections;
if (tmp == null) {
if (tmp == null || force) {
synchronized (this) {
tmp = sections;
if (tmp == null) {
if (tmp == null || force) {
ChunkSection[] chunkSections = getChunk().getSections();
tmp = new ChunkSection[chunkSections.length];
System.arraycopy(chunkSections, 0, tmp, 0, chunkSections.length);

View File

@ -820,17 +820,12 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
}
public ChunkSection[] getSections(boolean force) {
if (force && forceLoadSections) {
ChunkSection[] sections = getChunk().getSections();
ChunkSection[] copy = new ChunkSection[sections.length];
System.arraycopy(sections, 0, copy, 0, sections.length);
return copy;
}
force &= forceLoadSections;
ChunkSection[] tmp = sections;
if (tmp == null) {
if (tmp == null || force) {
synchronized (this) {
tmp = sections;
if (tmp == null) {
if (tmp == null || force) {
ChunkSection[] chunkSections = getChunk().getSections();
tmp = new ChunkSection[chunkSections.length];
System.arraycopy(chunkSections, 0, tmp, 0, chunkSections.length);

View File

@ -820,17 +820,12 @@ public class BukkitGetBlocks_1_16_5 extends CharGetBlocks implements BukkitGetBl
}
public ChunkSection[] getSections(boolean force) {
if (force && forceLoadSections) {
ChunkSection[] sections = getChunk().getSections();
ChunkSection[] copy = new ChunkSection[sections.length];
System.arraycopy(sections, 0, copy, 0, sections.length);
return copy;
}
force &= forceLoadSections;
ChunkSection[] tmp = sections;
if (tmp == null) {
if (tmp == null || force) {
synchronized (this) {
tmp = sections;
if (tmp == null) {
if (tmp == null || force) {
ChunkSection[] chunkSections = getChunk().getSections();
tmp = new ChunkSection[chunkSections.length];
System.arraycopy(chunkSections, 0, tmp, 0, chunkSections.length);