From ce0dda593132a25f7887749003466e7a42ce562f Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 14 Apr 2019 12:13:41 +1000 Subject: [PATCH] Fix ProtocolSupport compatibility --- .../java/com/boydti/fawe/bukkit/FaweBukkit.java | 3 +++ .../fawe/bukkit/v1_13/BukkitChunk_1_13.java | 2 +- .../fawe/bukkit/v1_13/BukkitQueue_1_13.java | 16 ++++++++++++---- .../java/com/boydti/fawe/config/Settings.java | 3 +++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java index 656946d09..4fe3c9ef7 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java @@ -120,6 +120,9 @@ public class FaweBukkit implements IFawe, Listener { // Registered delayed Event Listeners TaskManager.IMP.task(() -> { + // Fix for ProtocolSupport + Settings.IMP.PROTOCOL_SUPPORT_FIX = Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport"); + // This class Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java index f7fc16fdc..2fa21a314 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java @@ -238,7 +238,7 @@ public class BukkitChunk_1_13 extends IntFaweChunk { if (current == null) { continue; } - sectionPalettes[i] = copy(current); + copy.sectionPalettes[i] = copy(current); } } catch (Throwable e) { MainUtil.handleError(e); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java index 5c1d852f6..b6469c5d0 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java @@ -6,6 +6,7 @@ import com.boydti.fawe.bukkit.BukkitPlayer; import com.boydti.fawe.bukkit.adapter.v1_13_1.BlockMaterial_1_13; import com.boydti.fawe.bukkit.adapter.v1_13_1.Spigot_v1_13_R2; import com.boydti.fawe.bukkit.v0.BukkitQueue_0; +import com.boydti.fawe.config.Settings; import com.boydti.fawe.example.IntFaweChunk; import com.boydti.fawe.jnbt.anvil.BitArray4096; import com.boydti.fawe.object.FaweChunk; @@ -867,11 +868,17 @@ public class BukkitQueue_1_13 extends BukkitQueue_0> 6; if (num_palette == 1) { - // Set a value, because minecraft needs it for some reason - blockstates[0] = 0; - blockBitArrayEnd = 1; + // Set a value, because minecraft needs it for some reason even if the array is empty + for (int i = 0; i < blockBitArrayEnd; i++) blockstates[i] = 0; } else { BitArray4096 bitArray = new BitArray4096(blockstates, bitsPerEntry); bitArray.fromRaw(blocksCopy); @@ -886,7 +893,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0 palette; // DataPaletteHash hash = new DataPaletteHash<>(Block.REGISTRY_ID, num_palette, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a); - palette = new DataPaletteLinear<>(Block.REGISTRY_ID, num_palette, dataPaletteBlocks, GameProfileSerializer::d); + palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d); // set palette for (int i = 0; i < num_palette; i++) { int ordinal = paletteToBlock[i]; @@ -903,6 +910,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0