From 12114ec987f529f1857d71b1d523b3cbbd905ae8 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 29 Jul 2019 11:19:38 -0400 Subject: [PATCH] Minor changes --- .../java/com/sk89q/worldedit/EditSession.java | 20 ++++++++++--------- .../function/pattern/BlockPattern.java | 4 ++-- .../worldedit/world/block/BaseBlock.java | 4 ++-- .../worldedit/world/block/BlockState.java | 6 +++--- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 485023787..251694c32 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -150,13 +150,9 @@ import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; import javax.annotation.Nonnull; import javax.annotation.Nullable; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - /** * An {@link Extent} that handles history, {@link BlockBag}s, change limits, * block re-ordering, and much more. Most operations in WorldEdit use this class. @@ -170,6 +166,12 @@ public class EditSession extends AbstractDelegateExtent implements SimpleWorld, private static final Logger log = LoggerFactory.getLogger(EditSession.class); + //TODO + @Override + public String getId() { + return null; + } + /** * Used by {@link EditSession#setBlock(BlockVector3, BlockStateHolder, Stage)} to * determine which {@link Extent}s should be bypassed. @@ -1193,10 +1195,10 @@ public class EditSession extends AbstractDelegateExtent implements SimpleWorld, /** * Fills an area recursively in the X/Z directions. * - * @param origin the location to start from - * @param pattern the block to fill with - * @param radius the radius of the spherical area to fill - * @param depth the maximum depth, starting from the origin + * @param origin the location to start from + * @param pattern the block to fill with + * @param radius the radius of the spherical area to fill + * @param depth the maximum depth, starting from the origin * @param direction the direction to fill * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed @@ -2971,7 +2973,7 @@ public class EditSession extends AbstractDelegateExtent implements SimpleWorld, double scaledZ = (z - zero2D.getZ()) / unit2D.getZ(); try { - if (expression.evaluateTimeout(timeout, scaledX, scaledZ, timeout) <= 0) { + if (expression.evaluate(new double[]{scaledX, scaledZ}, timeout) <= 0) { return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java index 6ad68f5f9..118492bde 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java @@ -21,13 +21,14 @@ package com.sk89q.worldedit.function.pattern; import static com.google.common.base.Preconditions.checkNotNull; -import com.boydti.fawe.beta.FilterBlock; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; /** * A pattern that returns the same {@link BaseBlock} each time. + * + * @deprecated all BlockStateHolders can be used directly as a pattern */ @Deprecated public class BlockPattern extends AbstractPattern { @@ -39,7 +40,6 @@ public class BlockPattern extends AbstractPattern { * * @param block the block */ - @Deprecated public BlockPattern(BlockStateHolder block) { setBlock(block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java index 80ed33065..f6ed36737 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java @@ -182,7 +182,7 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { @Override public void setNbtData(@Nullable CompoundTag nbtData) { - throw new UnsupportedOperationException("Immutable"); + throw new UnsupportedOperationException("This class is immutable."); } /** @@ -239,7 +239,7 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { } @Override - public final BaseBlock toBaseBlock() { + public BaseBlock toBaseBlock() { return this; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index 07599940a..a0187ac4f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -301,6 +301,9 @@ public class BlockState implements BlockStateHolder, FawePattern { @Override public boolean equalsFuzzy(BlockStateHolder o) { + if (null == o) { + return false; + } if (this == o) { // Added a reference equality check for speediness return true; @@ -308,9 +311,6 @@ public class BlockState implements BlockStateHolder, FawePattern { if (o.getClass() == BlockState.class) { return o.getOrdinal() == this.getOrdinal(); } - if (null == o) { - return false; - } return o.equalsFuzzy(this); }