From df8e04cc6702b4c95d5436b3b230046f6256531d Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 14 Apr 2019 00:51:39 +1000 Subject: [PATCH] Fix ProtocolSupport issue --- .../fawe/bukkit/v1_13/BukkitQueue_1_13.java | 94 ++++++++++++------- 1 file changed, 62 insertions(+), 32 deletions(-) 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 65e3891f4..5c1d852f6 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 @@ -16,6 +16,7 @@ import com.boydti.fawe.object.visitor.FaweChunkVisitor; import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.ReflectionUtils; +import com.boydti.fawe.util.TaskManager; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockID; @@ -65,6 +66,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Map; import java.util.concurrent.atomic.LongAdder; +import java.util.function.Supplier; public class BukkitQueue_1_13 extends BukkitQueue_0 { @@ -106,6 +108,9 @@ public class BukkitQueue_1_13 extends BukkitQueue_0() { + @Override + public Object get() { + try { + int dirtyBits = fieldDirtyBits.getInt(playerChunk); + if (mask == 0) dirtyBits |= 65535; + else dirtyBits |= mask; + + fieldDirtyBits.set(playerChunk, dirtyBits); + fieldDirtyCount.set(playerChunk, 64); + PlayerChunkMap playerManager = ((CraftWorld) getWorld()).getHandle().getPlayerChunkMap(); + playerManager.a(playerChunk); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return null; } - } + }); } +// if (mask == 0) { +// PacketPlayOutMapChunk packet = new PacketPlayOutMapChunk(nmsChunk, 65535); +// for (EntityPlayer player : playerChunk.players) { +// player.playerConnection.sendPacket(packet); +// } +// return true; +// } +// // Send chunks +// boolean empty = false; +// ChunkSection[] sections = nmsChunk.getSections(); +// for (int i = 0; i < sections.length; i++) { +// if (sections[i] == null) { +// sections[i] = emptySection; +// empty = true; +// } +// } +// if (mask == 0 || mask == 65535 && hasEntities(nmsChunk)) { +// PacketPlayOutMapChunk packet = new PacketPlayOutMapChunk(nmsChunk, 65280); +// for (EntityPlayer player : playerChunk.players) { +// player.playerConnection.sendPacket(packet); +// } +// mask = 255; +// } +// PacketPlayOutMapChunk packet = new PacketPlayOutMapChunk(nmsChunk, mask); +// for (EntityPlayer player : playerChunk.players) { +// player.playerConnection.sendPacket(packet); +// } +// if (empty) { +// for (int i = 0; i < sections.length; i++) { +// if (sections[i] == emptySection) { +// sections[i] = null; +// } +// } +// } return true; }