From 51a5c226776ead6633ad92608edc9c7b4b1a5480 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 3 Oct 2019 20:27:19 -0400 Subject: [PATCH] I hope these are the last few errors --- .../com/sk89q/worldedit/bukkit/BukkitWorld.java | 13 +++++++++++-- .../worldedit/extension/platform/Actor.java | 2 +- .../worldedit/function/mask/ABlockMask.java | 10 +++------- .../com/sk89q/worldedit/function/mask/Mask.java | 16 ++++++++-------- .../worldedit/session/request/RequestExtent.java | 14 ++++++++++++-- .../com/sk89q/worldedit/world/NullWorld.java | 9 +++++++++ 6 files changed, 44 insertions(+), 20 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index cd308904d..48ff11687 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -28,7 +28,6 @@ import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.entity.BaseEntity; @@ -37,7 +36,6 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.biome.BiomeType; @@ -495,6 +493,12 @@ public class BukkitWorld extends AbstractWorld { return BukkitAdapter.adapt(getWorld().getBiome(position.getBlockX(), position.getBlockZ())); } + @Override + public > boolean setBlock(int x, int y, int z, T block) + throws WorldEditException { + return setBlock(BlockVector3.at(x,y,z), block); + } + @Override public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException { return false; @@ -506,6 +510,11 @@ public class BukkitWorld extends AbstractWorld { return true; } + @Override + public boolean setBiome(int x, int y, int z, BiomeType biome) { + return setBiome(BlockVector2.at(x,z), biome); + } + @Override public void sendChunk(int X, int Z, int mask) { } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java index 86e798ef3..b6139a4ca 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java @@ -84,7 +84,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, Metadatable */ void print(Component component); - /**F + /** * Returns true if the actor can destroy bedrock. * * @return true if bedrock can be broken by the actor diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java index 95fa6c4c1..0dcc944b4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java @@ -21,16 +21,12 @@ public abstract class ABlockMask extends AbstractExtentMask { List strings = new ArrayList<>(); for (BlockType type : BlockTypes.values) { if (type != null) { - boolean hasAll = true; - boolean hasAny = false; + boolean hasAll; List all = type.getAllStates(); - for (BlockState state : all) { - hasAll &= test(state); - hasAny = true; - } + hasAll = all.stream().map(this::test).reduce(true, (a, b) -> a && b); if (hasAll) { strings.add(type.getId()); - } else if (hasAny) { + } else { for (BlockState state : all) { if (test(state)) { strings.add(state.getAsString()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java index c289ad0cc..f335411f8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java @@ -81,15 +81,15 @@ public interface Mask { return value == null ? this : value; } - default Mask and(Mask other) { - Mask value = and(other); - return value == null ? new MaskIntersection(this, other) : value; - } +// default Mask and(Mask other) { +// Mask value = and(other); +// return value == null ? new MaskIntersection(this, other) : value; +// } - default Mask or(Mask other) { - Mask value = or(other); - return value == null ? new MaskUnion(this, other) : value; - } +// default Mask or(Mask other) { +// Mask value = or(other); +// return value == null ? new MaskUnion(this, other) : value; +// } default Mask inverse() { if (this instanceof Masks.AlwaysTrue) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java index 47c72de1b..0f3375721 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java @@ -34,9 +34,8 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; - -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; public class RequestExtent implements Extent { @@ -96,6 +95,12 @@ public class RequestExtent implements Extent { return getExtent().setBlock(position, block); } + @Override + public > boolean setBlock(int x, int y, int z, T block) + throws WorldEditException { + return getExtent().setBlock(x, y, z, block); + } + @Override public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException { return getExtent().setTile(x, y, z, tile); @@ -106,6 +111,11 @@ public class RequestExtent implements Extent { return getExtent().setBiome(position, biome); } + @Override + public boolean setBiome(int x, int y, int z, BiomeType biome) { + return getExtent().setBiome(BlockVector2.at(x,z), biome); + } + @Override @Nullable public Operation commit() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java index e30ed8fa9..a71a31779 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java @@ -87,11 +87,20 @@ public class NullWorld extends AbstractWorld { return false; } + @Override + public BiomeType getBiome(BlockVector2 position) { + return BiomeTypes.THE_VOID; + } @Override public BiomeType getBiomeType(int x, int z) { return BiomeTypes.THE_VOID; } + @Override + public boolean setBiome(BlockVector2 position, BiomeType biome) { + return false; + } + @Override public boolean setBiome(int x, int y, int z, BiomeType biome) { return false;