From 8a91f091923f017301213dba1dfc10fe569fff7c Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 23 May 2016 05:01:29 +1000 Subject: [PATCH] Fix vs mask --- .../main/java/com/thevoxelbox/voxelsniper/Sniper.java | 11 +++++++---- .../java/com/boydti/fawe/object/MaskedFaweQueue.java | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bukkit0/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java b/bukkit0/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java index c30b19be..6ead4a1f 100644 --- a/bukkit0/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java +++ b/bukkit0/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java @@ -71,7 +71,8 @@ public class Sniper { } // Added - public AsyncWorld tmpWorld; + private AsyncWorld tmpWorld; + private MaskedFaweQueue mask; // Added public World getWorld() { @@ -100,12 +101,14 @@ public class Sniper { FaweQueue queue; { Player player = getPlayer(); + FawePlayer fp = FawePlayer.wrap(player); + RegionWrapper[] mask = WEManager.IMP.getMask(fp).toArray(new RegionWrapper[0]); if (tmpWorld == null || !player.getWorld().getName().equals(tmpWorld.getName())) { - FawePlayer fp = FawePlayer.wrap(player); - RegionWrapper[] mask = WEManager.IMP.getMask(fp).toArray(new RegionWrapper[0]); queue = FaweAPI.createQueue(fp.getLocation().world, true); - queue = new MaskedFaweQueue(queue, mask); + this.mask = (MaskedFaweQueue) (queue = new MaskedFaweQueue(queue, mask)); tmpWorld = new AsyncWorld(player.getWorld(), queue); + } else if (this.mask != null) { + this.mask.setMask(mask); } if (clickedBlock != null) { clickedBlock = tmpWorld.getBlockAt(clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ()); diff --git a/core/src/main/java/com/boydti/fawe/object/MaskedFaweQueue.java b/core/src/main/java/com/boydti/fawe/object/MaskedFaweQueue.java index 2fb4cc4d..3264a2a3 100644 --- a/core/src/main/java/com/boydti/fawe/object/MaskedFaweQueue.java +++ b/core/src/main/java/com/boydti/fawe/object/MaskedFaweQueue.java @@ -6,13 +6,17 @@ import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.world.biome.BaseBiome; public class MaskedFaweQueue extends DelegateFaweQueue { - private final RegionWrapper[] mask; + private RegionWrapper[] mask; public MaskedFaweQueue(FaweQueue parent, RegionWrapper[] mask) { super(parent); this.mask = mask; } + public void setMask(RegionWrapper[] mask) { + this.mask = mask; + } + @Override public void setTile(int x, int y, int z, CompoundTag tag) { if (WEManager.IMP.maskContains(mask, x, z)) {