From 59ca29577ccff0765330d0f56ee66ead7b2e4942 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 13 Jul 2018 22:45:28 +1000 Subject: [PATCH] Remove weird TODO import and moved BlockType == Material to BukkitUtil --- .../com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java | 4 ++-- .../main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java | 7 +++++++ .../function/generator/GardenPatchGenerator.java | 9 +++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java index 05f3d4609..6c13a12c8 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java @@ -79,7 +79,7 @@ public class BukkitPlayerBlockBag extends BlockBag { continue; } - if (!bukkitItem.getType().getKey().toString().equals(blockState.getBlockType().getId())) { + if (!BukkitUtil.equals(blockState.getBlockType(), bukkitItem.getType())) { // Type id doesn't fit continue; } @@ -132,7 +132,7 @@ public class BukkitPlayerBlockBag extends BlockBag { continue; } - if (!bukkitItem.getType().getKey().toString().equals(blockState.getBlockType().getId())) { + if (!BukkitUtil.equals(blockState.getBlockType(), bukkitItem.getType())) { // Type id doesn't fit continue; } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java index 9f8f7a969..f5744f6ea 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java @@ -27,9 +27,11 @@ import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.item.ItemTypes; import org.bukkit.Bukkit; +import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.World; import org.bukkit.block.Block; @@ -39,6 +41,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import java.util.List; +import java.util.Objects; public final class BukkitUtil { @@ -108,6 +111,10 @@ public final class BukkitUtil { return true; } + public static boolean equals(BlockType blockType, Material type) { + return Objects.equals(blockType.getId(), type.getKey().toString()); + } + public static final double EQUALS_PRECISION = 0.0001; public static org.bukkit.Location toLocation(Location location) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java index 3abc89a32..ad9d906fb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java @@ -23,15 +23,12 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.RandomPattern; -import com.sun.xml.internal.bind.v2.TODO; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.Random;