From 9869cf09c6d79bc9f99e2a470dfd2a16f078e540 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 30 Apr 2020 15:14:59 +0100 Subject: [PATCH] Apply fda7d00747abe97d7891b80ed8bb88d97e1c70d1 to other versions so numpties that use old versions for no reason stop complaining too --- .../adapter/mc1_14/BukkitGetBlocks_1_14.java | 23 ++++++++----------- .../adapter/mc1_15/BukkitGetBlocks_1_15.java | 23 ++++++++----------- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java index 4e585f2ae..803b5e27d 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java @@ -206,10 +206,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks { if (this.sections == null) { this.sections = sections.clone(); } - //TODO: Understand why this causes #329, what the purpose of this is, and what may or may not break after commenting this out. -// if (this.sections[layer] != section) { -// this.sections[layer] = section; -// } + if (this.sections[layer] != section) { + this.sections[layer] = section; + } this.blocks[layer] = arr; } } @@ -279,19 +278,17 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks { synchronized (this) { synchronized (lock) { lock.untilFree(); - ChunkSection getSection; if (this.nmsChunk != nmsChunk) { this.nmsChunk = nmsChunk; this.sections = null; this.reset(); - } else { - getSection = this.getSections()[layer]; - if (getSection != existingSection) { - this.sections[layer] = existingSection; - this.reset(); - } else if (lock.isModified()) { - this.reset(layer); - } + } else if (existingSection != getSections()[layer]) { + this.sections[layer] = existingSection; + this.reset(); + } else if (!Arrays.equals(update(layer, new char[4096]), load(layer))) { + this.reset(layer); + } else if (lock.isModified()) { + this.reset(layer); } newSection = BukkitAdapter_1_14.newChunkSection(layer, this::load, setArr); if (!BukkitAdapter_1_14.setSectionAtomic(sections, existingSection, newSection, layer)) { diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java index 4a399655d..eb92c5502 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java @@ -214,10 +214,9 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks { if (this.sections == null) { this.sections = sections.clone(); } - //TODO: Understand why this causes #329, what the purpose of this is, and what may or may not break after commenting this out. -// if (this.sections[layer] != section) { -// this.sections[layer] = section; -// } + if (this.sections[layer] != section) { + this.sections[layer] = section; + } this.blocks[layer] = arr; } } @@ -287,19 +286,17 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks { synchronized (this) { synchronized (lock) { lock.untilFree(); - ChunkSection getSection; if (this.nmsChunk != nmsChunk) { this.nmsChunk = nmsChunk; this.sections = null; this.reset(); - } else { - getSection = this.getSections()[layer]; - if (getSection != existingSection) { - this.sections[layer] = existingSection; - this.reset(); - } else if (lock.isModified()) { - this.reset(layer); - } + } else if (existingSection != getSections()[layer]) { + this.sections[layer] = existingSection; + this.reset(); + } else if (!Arrays.equals(update(layer, new char[4096]), load(layer))) { + this.reset(layer); + } else if (lock.isModified()) { + this.reset(layer); } newSection = BukkitAdapter_1_15.newChunkSection(layer, this::load, setArr); if (!BukkitAdapter_1_15.setSectionAtomic(sections, existingSection, newSection, layer)) {