From bad3d31d90624a965b8b9827ab2d2f9a326c97ae Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 14 Jan 2021 17:03:32 +0000 Subject: [PATCH] Fix removing section lighting - Paper and spigot differ in methods - Also don't clone it as we're trying to fill the actual data... --- .../bukkit/adapter/mc1_15_2/BukkitGetBlocks_1_15_2.java | 9 +++++---- .../bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java | 9 +++++---- .../bukkit/adapter/mc1_16_2/BukkitGetBlocks_1_16_2.java | 9 +++++---- .../bukkit/adapter/mc1_16_4/BukkitGetBlocks_1_16_4.java | 9 +++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15_2/BukkitGetBlocks_1_15_2.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15_2/BukkitGetBlocks_1_15_2.java index a2ab70498..33e200737 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15_2/BukkitGetBlocks_1_15_2.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15_2/BukkitGetBlocks_1_15_2.java @@ -27,6 +27,7 @@ import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockTypes; +import io.papermc.lib.PaperLib; import net.minecraft.server.v1_15_R1.BiomeBase; import net.minecraft.server.v1_15_R1.BiomeStorage; import net.minecraft.server.v1_15_R1.BlockPosition; @@ -181,8 +182,8 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl if (nibble != null) { lightUpdate = true; synchronized (nibble) { - byte[] bytes = nibble.getCloneIfSet(); - if (bytes != NibbleArray.EMPTY_NIBBLE) { + byte[] bytes = PaperLib.isPaper() ? nibble.getIfSet() : nibble.asBytes(); + if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) { Arrays.fill(bytes, (byte) 0); } } @@ -193,8 +194,8 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl if (nibble != null) { lightUpdate = true; synchronized (nibbleSky) { - byte[] bytes = nibbleSky.getCloneIfSet(); - if (bytes != NibbleArray.EMPTY_NIBBLE) { + byte[] bytes = PaperLib.isPaper() ? nibbleSky.getIfSet() : nibbleSky.asBytes(); + if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) { Arrays.fill(bytes, (byte) 0); } } diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java index 1656fcb60..20182af7b 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java @@ -27,6 +27,7 @@ import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockTypes; +import io.papermc.lib.PaperLib; import net.minecraft.server.v1_16_R1.BiomeBase; import net.minecraft.server.v1_16_R1.BiomeStorage; import net.minecraft.server.v1_16_R1.BlockPosition; @@ -182,8 +183,8 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl if (nibble != null) { lightUpdate = true; synchronized (nibble) { - byte[] bytes = nibble.getCloneIfSet(); - if (bytes != NibbleArray.EMPTY_NIBBLE) { + byte[] bytes = PaperLib.isPaper() ? nibble.getIfSet() : nibble.asBytes(); + if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) { Arrays.fill(bytes, (byte) 0); } } @@ -194,8 +195,8 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl if (nibble != null) { lightUpdate = true; synchronized (nibbleSky) { - byte[] bytes = nibbleSky.getCloneIfSet(); - if (bytes != NibbleArray.EMPTY_NIBBLE) { + byte[] bytes = PaperLib.isPaper() ? nibbleSky.getIfSet() : nibbleSky.asBytes(); + if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) { Arrays.fill(bytes, (byte) 0); } } diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_2/BukkitGetBlocks_1_16_2.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_2/BukkitGetBlocks_1_16_2.java index 4e7167274..23d47d3f4 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_2/BukkitGetBlocks_1_16_2.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_2/BukkitGetBlocks_1_16_2.java @@ -27,6 +27,7 @@ import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockTypes; +import io.papermc.lib.PaperLib; import net.minecraft.server.v1_16_R2.BiomeBase; import net.minecraft.server.v1_16_R2.BiomeStorage; import net.minecraft.server.v1_16_R2.BlockPosition; @@ -182,8 +183,8 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl if (nibble != null) { lightUpdate = true; synchronized (nibble) { - byte[] bytes = nibble.getCloneIfSet(); - if (bytes != NibbleArray.EMPTY_NIBBLE) { + byte[] bytes = PaperLib.isPaper() ? nibble.getIfSet() : nibble.asBytes(); + if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) { Arrays.fill(bytes, (byte) 0); } } @@ -194,8 +195,8 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl if (nibble != null) { lightUpdate = true; synchronized (nibbleSky) { - byte[] bytes = nibbleSky.getCloneIfSet(); - if (bytes != NibbleArray.EMPTY_NIBBLE) { + byte[] bytes = PaperLib.isPaper() ? nibbleSky.getIfSet() : nibbleSky.asBytes(); + if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) { Arrays.fill(bytes, (byte) 0); } } diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_4/BukkitGetBlocks_1_16_4.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_4/BukkitGetBlocks_1_16_4.java index 2a6d84bfa..b2c2a0b23 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_4/BukkitGetBlocks_1_16_4.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_4/BukkitGetBlocks_1_16_4.java @@ -27,6 +27,7 @@ import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockTypes; +import io.papermc.lib.PaperLib; import net.minecraft.server.v1_16_R3.BiomeBase; import net.minecraft.server.v1_16_R3.BiomeStorage; import net.minecraft.server.v1_16_R3.BlockPosition; @@ -182,8 +183,8 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl if (nibble != null) { lightUpdate = true; synchronized (nibble) { - byte[] bytes = nibble.getCloneIfSet(); - if (bytes != NibbleArray.EMPTY_NIBBLE) { + byte[] bytes = PaperLib.isPaper() ? nibble.getIfSet() : nibble.asBytes(); + if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) { Arrays.fill(bytes, (byte) 0); } } @@ -194,8 +195,8 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl if (nibble != null) { lightUpdate = true; synchronized (nibbleSky) { - byte[] bytes = nibbleSky.getCloneIfSet(); - if (bytes != NibbleArray.EMPTY_NIBBLE) { + byte[] bytes = PaperLib.isPaper() ? nibbleSky.getIfSet() : nibbleSky.asBytes(); + if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) { Arrays.fill(bytes, (byte) 0); } }