3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00

Don't attempt to set field on null ChunkSection

Dieser Commit ist enthalten in:
dordsor21 2020-05-09 17:42:40 +01:00
Ursprung cb20cef0e6
Commit 0dee452e1a
3 geänderte Dateien mit 12 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -262,10 +262,6 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
char[] setArr = set.load(layer); char[] setArr = set.load(layer);
ChunkSection newSection; ChunkSection newSection;
ChunkSection existingSection = sections[layer]; ChunkSection existingSection = sections[layer];
//ensure that the server doesn't try to tick the chunksection while we're editing it.
BukkitAdapter_1_14.fieldTickingBlockCount.set(existingSection, (short) 0);
if (existingSection == null) { if (existingSection == null) {
newSection = BukkitAdapter_1_14.newChunkSection(layer, setArr); newSection = BukkitAdapter_1_14.newChunkSection(layer, setArr);
if (BukkitAdapter_1_14.setSectionAtomic(sections, null, newSection, layer)) { if (BukkitAdapter_1_14.setSectionAtomic(sections, null, newSection, layer)) {
@ -279,6 +275,10 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
} }
} }
} }
//ensure that the server doesn't try to tick the chunksection while we're editing it.
BukkitAdapter_1_14.fieldTickingBlockCount.set(existingSection, (short) 0);
DelegateLock lock = BukkitAdapter_1_14.applyLock(existingSection); DelegateLock lock = BukkitAdapter_1_14.applyLock(existingSection);
synchronized (this) { synchronized (this) {
synchronized (lock) { synchronized (lock) {

Datei anzeigen

@ -270,10 +270,6 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
char[] setArr = set.load(layer); char[] setArr = set.load(layer);
ChunkSection newSection; ChunkSection newSection;
ChunkSection existingSection = sections[layer]; ChunkSection existingSection = sections[layer];
//ensure that the server doesn't try to tick the chunksection while we're editing it.
BukkitAdapter_1_15.fieldTickingBlockCount.set(existingSection, (short) 0);
if (existingSection == null) { if (existingSection == null) {
newSection = BukkitAdapter_1_15.newChunkSection(layer, setArr); newSection = BukkitAdapter_1_15.newChunkSection(layer, setArr);
if (BukkitAdapter_1_15.setSectionAtomic(sections, null, newSection, layer)) { if (BukkitAdapter_1_15.setSectionAtomic(sections, null, newSection, layer)) {
@ -287,6 +283,10 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
} }
} }
} }
//ensure that the server doesn't try to tick the chunksection while we're editing it.
BukkitAdapter_1_15.fieldTickingBlockCount.set(existingSection, (short) 0);
DelegateLock lock = BukkitAdapter_1_15.applyLock(existingSection); DelegateLock lock = BukkitAdapter_1_15.applyLock(existingSection);
synchronized (this) { synchronized (this) {
synchronized (lock) { synchronized (lock) {

Datei anzeigen

@ -282,10 +282,6 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
char[] setArr = set.load(layer); char[] setArr = set.load(layer);
ChunkSection newSection; ChunkSection newSection;
ChunkSection existingSection = sections[layer]; ChunkSection existingSection = sections[layer];
//ensure that the server doesn't try to tick the chunksection while we're editing it.
BukkitAdapter_1_15_2.fieldTickingBlockCount.set(existingSection, (short) 0);
if (existingSection == null) { if (existingSection == null) {
newSection = BukkitAdapter_1_15_2.newChunkSection(layer, setArr); newSection = BukkitAdapter_1_15_2.newChunkSection(layer, setArr);
if (BukkitAdapter_1_15_2.setSectionAtomic(sections, null, newSection, layer)) { if (BukkitAdapter_1_15_2.setSectionAtomic(sections, null, newSection, layer)) {
@ -299,7 +295,11 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
} }
} }
} }
BukkitAdapter_1_15_2.fieldTickingBlockCount.set(existingSection, (short) 0);
//ensure that the server doesn't try to tick the chunksection while we're editing it.
DelegateLock lock = BukkitAdapter_1_15_2.applyLock(existingSection); DelegateLock lock = BukkitAdapter_1_15_2.applyLock(existingSection);
synchronized (this) { synchronized (this) {
synchronized (lock) { synchronized (lock) {
lock.untilFree(); lock.untilFree();