From 7b83f97c351e545f4d08ca6f38b41777871d23a9 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 19 Aug 2018 14:41:09 +1000 Subject: [PATCH 1/7] Fixed NotABlockException not getting thrown --- .../main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java | 6 ++++-- .../worldedit/extension/platform/AbstractPlayerActor.java | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java index faa7e5b57..f7500168a 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java @@ -22,8 +22,10 @@ package com.sk89q.worldedit.bukkit; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.Function; +import com.sk89q.worldedit.NotABlockException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extension.input.InputParseException; @@ -360,12 +362,12 @@ public class BukkitAdapter { * @param itemStack The Bukkit ItemStack * @return The WorldEdit BlockState */ - public static BlockState asBlockState(ItemStack itemStack) { + public static BlockState asBlockState(ItemStack itemStack) throws WorldEditException { checkNotNull(itemStack); if (itemStack.getType().isBlock()) { return adapt(itemStack.getType().createBlockData()); } else { - return BlockTypes.AIR.getDefaultState(); + throw new NotABlockException(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index 4c3ced012..e738f8004 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.extension.platform; +import com.sk89q.worldedit.NotABlockException; import com.sk89q.worldedit.PlayerDirection; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; @@ -370,7 +371,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { if (typeId.hasBlockType()) { return typeId.getBlockType().getDefaultState().toBaseBlock(); } else { - return BlockTypes.AIR.getDefaultState().toBaseBlock(); + throw new NotABlockException(); } } From 69ab1781c6b1070669173288abf0b5af9eb31925 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 20 Aug 2018 15:57:42 +1000 Subject: [PATCH 2/7] Replace FuzzyBlockMask with BlockMask, and added BlockTypeMask as a more performant mask for just block types. --- .../java/com/sk89q/worldedit/EditSession.java | 14 +-- .../worldedit/command/BrushCommands.java | 4 +- .../worldedit/function/block/Naturalizer.java | 9 +- .../worldedit/function/mask/BlockMask.java | 4 +- .../function/mask/BlockTypeMask.java | 106 ++++++++++++++++++ .../function/mask/FuzzyBlockMask.java | 45 -------- .../sk89q/worldedit/world/AbstractWorld.java | 6 +- 7 files changed, 121 insertions(+), 67 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java 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 722c88d71..fdbbb8e3b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -25,7 +25,6 @@ import static com.sk89q.worldedit.regions.Regions.asFlatRegion; import static com.sk89q.worldedit.regions.Regions.maximumBlockY; import static com.sk89q.worldedit.regions.Regions.minimumBlockY; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.event.extent.EditSessionEvent; @@ -51,9 +50,9 @@ import com.sk89q.worldedit.function.block.Counter; import com.sk89q.worldedit.function.block.Naturalizer; import com.sk89q.worldedit.function.generator.GardenPatchGenerator; import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.mask.BoundedHeightMask; import com.sk89q.worldedit.function.mask.ExistingBlockMask; -import com.sk89q.worldedit.function.mask.FuzzyBlockMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.MaskIntersection; import com.sk89q.worldedit.function.mask.MaskUnion; @@ -102,6 +101,7 @@ import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.world.NullWorld; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -601,7 +601,7 @@ public class EditSession implements Extent { * @return the number of blocks that matched the pattern */ public int countBlocks(Region region, Set searchBlocks) { - FuzzyBlockMask mask = new FuzzyBlockMask(this, searchBlocks); + BlockMask mask = new BlockMask(this, searchBlocks); Counter count = new Counter(); RegionMaskingFilter filter = new RegionMaskingFilter(mask, count); RegionVisitor visitor = new RegionVisitor(region, filter); @@ -725,7 +725,7 @@ public class EditSession implements Extent { checkNotNull(position); checkArgument(apothem >= 1, "apothem >= 1"); - Mask mask = new FuzzyBlockMask(this, blockType.getDefaultState().toFuzzy()); + Mask mask = new BlockTypeMask(this, blockType); Vector adjustment = new Vector(1, 1, 1).multiply(apothem - 1); Region region = new CuboidRegion( getWorld(), // Causes clamping of Y range @@ -790,7 +790,7 @@ public class EditSession implements Extent { * @throws MaxChangedBlocksException thrown if too many blocks are changed */ public int replaceBlocks(Region region, Set filter, Pattern pattern) throws MaxChangedBlocksException { - Mask mask = filter == null ? new ExistingBlockMask(this) : new FuzzyBlockMask(this, filter); + Mask mask = filter == null ? new ExistingBlockMask(this) : new BlockMask(this, filter); return replaceBlocks(region, mask, pattern); } @@ -1141,10 +1141,10 @@ public class EditSession implements Extent { checkArgument(radius >= 0, "radius >= 0 required"); // Our origins can only be liquids - BlockMask liquidMask = new BlockMask(this, fluid.getDefaultState().toFuzzy()); + Mask liquidMask = new BlockTypeMask(this, fluid); // But we will also visit air blocks - MaskIntersection blockMask = new MaskUnion(liquidMask, new BlockMask(this, BlockTypes.AIR.getDefaultState())); + MaskIntersection blockMask = new MaskUnion(liquidMask, Masks.negate(new ExistingBlockMask(this))); // There are boundaries that the routine needs to stay in MaskIntersection mask = new MaskIntersection( diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index 045dc6fbe..126653046 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -42,7 +42,7 @@ import com.sk89q.worldedit.command.tool.brush.SphereBrush; import com.sk89q.worldedit.command.util.CreatureButcher; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.session.ClipboardHolder; @@ -192,7 +192,7 @@ public class BrushCommands { Pattern fill = new BlockPattern(BlockTypes.AIR.getDefaultState()); tool.setFill(fill); tool.setSize(radius); - tool.setMask(new BlockMask(editSession, BlockTypes.FIRE.getDefaultState().toFuzzy())); + tool.setMask(new BlockTypeMask(editSession, BlockTypes.FIRE)); tool.setBrush(new SphereBrush(), "worldedit.brush.ex"); player.print(String.format("Extinguisher equipped (%.0f).", radius)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java index 1c56d8a4f..ba2cf9a3d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java @@ -21,12 +21,11 @@ package com.sk89q.worldedit.function.block; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.collect.Sets; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.LayerFunction; -import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.world.block.BlockTypes; @@ -49,11 +48,7 @@ public class Naturalizer implements LayerFunction { public Naturalizer(EditSession editSession) { checkNotNull(editSession); this.editSession = editSession; - this.mask = new BlockMask(editSession, Sets.newHashSet( - BlockTypes.GRASS_BLOCK.getDefaultState(), - BlockTypes.DIRT.getDefaultState(), - BlockTypes.STONE.getDefaultState() - )); + this.mask = new BlockTypeMask(editSession, BlockTypes.GRASS_BLOCK, BlockTypes.DIRT, BlockTypes.STONE); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java index 0eee90887..d200f3f30 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java @@ -36,8 +36,8 @@ import javax.annotation.Nullable; * A mask that checks whether blocks at the given positions are matched by * a block in a list. * - *

This mask checks for both an exact block ID and data value match, as well - * for a block with the same ID but a data value of -1.

+ *

This mask checks for both an exact block type and state value match, + * respecting fuzzy status of the BlockState.

*/ public class BlockMask extends AbstractExtentMask { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java new file mode 100644 index 000000000..0e2ab590e --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java @@ -0,0 +1,106 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.function.mask; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.world.block.BlockType; + +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import javax.annotation.Nullable; + +/** + * A mask that checks whether blocks at the given positions are matched by + * a block in a list. + * + *

This mask checks for ONLY the block type. If state should also be checked, + * use {@link BlockMask}.

+ */ +public class BlockTypeMask extends AbstractExtentMask { + + private final Set blocks = new HashSet<>(); + + /** + * Create a new block mask. + * + * @param extent the extent + * @param blocks a list of blocks to match + */ + public BlockTypeMask(Extent extent, Collection blocks) { + super(extent); + checkNotNull(blocks); + this.blocks.addAll(blocks); + } + + /** + * Create a new block mask. + * + * @param extent the extent + * @param block an array of blocks to match + */ + public BlockTypeMask(Extent extent, BlockType... block) { + this(extent, Arrays.asList(checkNotNull(block))); + } + + /** + * Add the given blocks to the list of criteria. + * + * @param blocks a list of blocks + */ + public void add(Collection blocks) { + checkNotNull(blocks); + this.blocks.addAll(blocks); + } + + /** + * Add the given blocks to the list of criteria. + * + * @param block an array of blocks + */ + public void add(BlockType... block) { + add(Arrays.asList(checkNotNull(block))); + } + + /** + * Get the list of blocks that are tested with. + * + * @return a list of blocks + */ + public Collection getBlocks() { + return blocks; + } + + @Override + public boolean test(Vector vector) { + return blocks.contains(getExtent().getBlock(vector).getBlockType()); + } + + @Nullable + @Override + public Mask2D toMask2D() { + return null; + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java deleted file mode 100644 index 8b47e2c2c..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.function.mask; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.Blocks; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.world.block.BlockStateHolder; - -import java.util.Collection; - -public class FuzzyBlockMask extends BlockMask { - - public FuzzyBlockMask(Extent extent, Collection blocks) { - super(extent, blocks); - } - - public FuzzyBlockMask(Extent extent, BlockStateHolder... block) { - super(extent, block); - } - - @Override - public boolean test(Vector vector) { - Extent extent = getExtent(); - Collection blocks = getBlocks(); - return Blocks.containsFuzzy(blocks, extent.getFullBlock(vector)); - } -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java index d0c399c0d..4007125f6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java @@ -25,7 +25,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.util.Direction; @@ -62,9 +62,7 @@ public abstract class AbstractWorld implements World { @Override public Mask createLiquidMask() { - return new BlockMask(this, - BlockTypes.LAVA.getDefaultState().toFuzzy(), - BlockTypes.WATER.getDefaultState().toFuzzy()); + return new BlockTypeMask(this, BlockTypes.LAVA, BlockTypes.WATER); } @Override From 58a5d9961bc2d02d040fde6c1cebca82407a6766 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 23 Aug 2018 20:15:31 +1000 Subject: [PATCH 3/7] Minor formatting and neatness changes. --- .../com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java | 9 ++++++++- .../sk89q/worldedit/bukkit/BukkitEntityProperties.java | 7 ++----- .../com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java | 1 - 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java index e347f2593..88e4784d4 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java @@ -62,7 +62,14 @@ public class BukkitBlockRegistry extends BundledBlockRegistry { @Override public boolean isAir() { - return material == Material.AIR || material == Material.CAVE_AIR || material == Material.VOID_AIR; + switch (material) { + case AIR: + case CAVE_AIR: + case VOID_AIR: + return true; + default: + return false; + } } @Override diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntityProperties.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntityProperties.java index 86618f62f..fd40f0203 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntityProperties.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntityProperties.java @@ -22,9 +22,9 @@ package com.sk89q.worldedit.bukkit; import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.entity.metadata.EntityProperties; -import com.sk89q.worldedit.util.Enums; import org.bukkit.entity.Ambient; import org.bukkit.entity.Animals; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Boat; import org.bukkit.entity.ComplexEntityPart; import org.bukkit.entity.Entity; @@ -46,9 +46,6 @@ import org.bukkit.entity.minecart.ExplosiveMinecart; class BukkitEntityProperties implements EntityProperties { - private static final org.bukkit.entity.EntityType armorStandType = - Enums.findByValue(org.bukkit.entity.EntityType.class, "ARMOR_STAND"); - private final Entity entity; BukkitEntityProperties(Entity entity) { @@ -143,7 +140,7 @@ class BukkitEntityProperties implements EntityProperties { @Override public boolean isArmorStand() { - return entity.getType() == armorStandType; + return entity instanceof ArmorStand; } @Override 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 d4ec870bc..4fe00edb8 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 @@ -26,7 +26,6 @@ import com.sk89q.worldedit.extent.inventory.OutOfBlocksException; import com.sk89q.worldedit.extent.inventory.OutOfSpaceException; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypes; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; From 6c7a49733c0fde491f615cc71b68c18a2d35c5ec Mon Sep 17 00:00:00 2001 From: Pieter12345 Date: Sun, 26 Aug 2018 21:34:33 +0200 Subject: [PATCH 4/7] Fix plugin enabling on Bukkit without compatible adapter When loading WorldEdit on a Bukkit server which it does not have an adapter for, a stacktrace is printed to console and WorldEdit does not load. This commit fixes that by registering the BukkitServerInterface before attempting to find a matching adapter. --- .../main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index ab0d08fba..324babd4f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -82,11 +82,10 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { WorldEdit worldEdit = WorldEdit.getInstance(); - loadAdapter(); // Need an adapter to work with special blocks with NBT data - // Setup platform server = new BukkitServerInterface(this, getServer()); worldEdit.getPlatformManager().register(server); + loadAdapter(); // Need an adapter to work with special blocks with NBT data worldEdit.loadMappings(); loadConfig(); // Load configuration From fb5cb9a7bbc1ec4c069528d2b321102544fa1c3a Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 27 Aug 2018 13:29:29 +1000 Subject: [PATCH 5/7] Added a 1.13.1 adapter. --- .../bukkit/adapter/impl/Spigot_v1_13_R2.class | Bin 0 -> 21605 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2.class diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2.class new file mode 100644 index 0000000000000000000000000000000000000000..e0baf570d0f22d4a2c0eea858ea8e542e08c5411 GIT binary patch literal 21605 zcmbt+34B!5_5V5dPV$nM#}*6{5sZo$LNKBfF+mgpXdnql5DYFjBtwWKGjTEjv8~p9 zse9dU12?d4MXD2G6j3YgRkU?$t$X*~E^1YN-*exanKxm`#Q$GEym@n%bI*RxJ@-yt z{N}N3L^N5yVbhnqO&(9$G?cg7{1iW(&zhgH_-8gh%R8j`Ig6jq;}_)hMd^IW=9l>u zi+`TSuUhQ)`Ut9c*O_M<_klclbB1^HYl+yADV3x|ke3fe{ z%ci4Lo{Y)Q;Wo`xd9RwLBj z(l=7R=H;tmwNC+^twt57ebs1rjIq>y0<=U%?GFOf0rEId9%JQkkUYkLE$ZNWRjS5= z4pml2qz<*!By||Lqz<>$WGqAbs_%eRYKoSVR5K((n+^44zC zR28;V#8MqL-LB5CX}yYCs?$<2o9RYpL(qbf5aZ zP4}y_Ep?8F_XjpTqzWu`uBFbi>0x!gO&UYDG2IknDGH(TnK z0vfDtwdp1P&{DTq>UNu66`8HKDPL`Xg{eE_?M_jdyX0}Vt?p49h2%}b#Ct9E;{tkD z-6xOxE%ks9|Deq~)kDIIsL=is;lgU6db6z_R$GJ#X9>|iwbdi)QQ^VaLU!C%-D;~4 z+#{r4Af!GfL|+0FT%vjfna72kCv3G%Jt@>(FVt+e)l=$eA#NRrQP0@)qEH0yu~R(@ zU!Zna>bX4iyro_!pk3-@n@&(K+Uh0svZY?J)X$l6+afJ3p(xWnwWkMH2P?W_t!)+3 z)*5c9s5O06OvA&=W3{cFu|>fa`IyrhYHMaHcBixjF*F)l(H3foRhTZ!D8!8FXeby9 zVN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N%0ujTbU_*f+Nn|8fcE=IC`9ToM` z?P5>s|no6PWy(z+>5AIIsFZu(R@?l&FxNyq(h z`fZ$k*G<2dj)zRg4C#0%PJf8gAF*?gjxA<^hoxgnoc`2Jf0ov`X?;{$<8k^+H~m#w zx2>ZYy_64A{+rOgO)}2EyXj=gUye@t%l9gCphU>8LFqr1Y})m{A@v!9$wtzXbYorelY6JQt^b$LT-a^k3N0T$7!DCn>~1%8}Qr62kC3i)7(d85cJFV_6j`Bt5DF_;AwVJF~3gxECew)6>?;t~Y7d50`(cS!Ox}V>pC-^t?Gkzal<^v=eAHvIg zM4$1;@G_rpK7Y!?@Yf$l@bCBt{ynnXKVZlDM|hb(aXtPJ6{CU!hs*p%Lh+Rtn{^nSd7b|4c1^h5?f#MINDQH^{g&u)G zeJB4Ep5!5XyN(|*K4@pc-0+7kZ@>)K2T4uMh5IOYA)e=O8lL+#mAIKO+|HNS7!{2i zIkKq8_#>E8-1wsdzd*;xqEjsHRzqzm>$+A1YezK%fb6pEw5vzn#dG+oOvuF~io4}J z8wfr|1PG`Odk|1ZF%X6(A;cLAsJ?I(```?9;ehDJ&1z5ZPw=@9JjlE16n-cde|l0M pr{^A1tY6Zv>6fWkNo@;TGgXd%6V)NA!o1B@^VD4L?F2RV{{WG&BU}Ig literal 0 HcmV?d00001 From c931095736e6df8e65a969ee1167c90a480c13e4 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 27 Aug 2018 17:24:18 +1000 Subject: [PATCH 6/7] Little bit of formatting --- .../minecraft/util/commands/Injector.java | 2 +- .../minecraft/util/commands/Logging.java | 2 +- .../java/com/sk89q/util/yaml/YAMLNode.java | 2 +- .../java/com/sk89q/worldedit/WorldEdit.java | 8 ++--- .../worldedit/blocks/metadata/MobType.java | 2 +- .../worldedit/command/ClipboardCommands.java | 1 - .../worldedit/command/tool/BlockTool.java | 2 +- .../command/tool/DoubleActionBlockTool.java | 2 +- .../command/tool/DoubleActionTraceTool.java | 2 +- .../command/tool/LongRangeBuildTool.java | 1 - .../sk89q/worldedit/command/tool/Tool.java | 2 +- .../worldedit/command/tool/TraceTool.java | 2 +- .../worldedit/command/tool/brush/Brush.java | 2 +- .../clipboard/io/MCEditSchematicReader.java | 1 - .../clipboard/io/SpongeSchematicReader.java | 1 - .../worldedit/extent/inventory/BlockBag.java | 1 - .../extent/inventory/BlockBagExtent.java | 1 - .../extent/world/SurvivalModeExtent.java | 1 - .../worldedit/function/EntityFunction.java | 2 +- .../function/FlatRegionFunction.java | 2 +- .../worldedit/function/RegionFunction.java | 2 +- .../function/mask/ExistingBlockMask.java | 1 - .../internal/annotation/Direction.java | 2 +- .../worldedit/internal/cui/CUIEvent.java | 4 +-- .../worldedit/internal/cui/CUIRegion.java | 10 +++--- .../internal/expression/Identifiable.java | 4 +-- .../internal/expression/runtime/LValue.java | 6 ++-- .../internal/expression/runtime/RValue.java | 6 ++-- .../internal/util/DocumentationPrinter.java | 4 +-- .../math/interpolation/Interpolation.java | 6 ++-- .../sk89q/worldedit/regions/FlatRegion.java | 6 ++-- .../worldedit/regions/RegionSelector.java | 32 +++++++++---------- .../regions/selector/RegionSelectorType.java | 2 +- .../scripting/CraftScriptEngine.java | 6 ++-- .../worldedit/session/SessionManager.java | 2 +- .../com/sk89q/worldedit/util/TargetBlock.java | 1 - .../worldedit/util/YAMLConfiguration.java | 2 +- .../worldedit/util/command/Parameter.java | 2 +- .../worldedit/util/formatting/Style.java | 8 ++--- .../worldedit/world/block/BaseBlock.java | 1 - .../worldedit/world/snapshot/Snapshot.java | 2 +- .../world/snapshot/SnapshotDateParser.java | 2 +- .../storage/TrueZipLegacyChunkStore.java | 2 +- .../storage/TrueZipMcRegionChunkStore.java | 4 +-- .../world/storage/ZippedLegacyChunkStore.java | 2 +- .../storage/ZippedMcRegionChunkStore.java | 4 +-- 46 files changed, 76 insertions(+), 86 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Injector.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Injector.java index 4978e8eeb..0ac9fb166 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Injector.java +++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Injector.java @@ -35,6 +35,6 @@ public interface Injector { * @throws InstantiationException thrown on injection fault * @throws InvocationTargetException thrown on injection fault */ - public Object getInstance(Class cls) throws InvocationTargetException, IllegalAccessException, InstantiationException; + Object getInstance(Class cls) throws InvocationTargetException, IllegalAccessException, InstantiationException; } diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Logging.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Logging.java index dc64b5e16..d8d87dcc0 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Logging.java +++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Logging.java @@ -31,7 +31,7 @@ import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) public @interface Logging { - public enum LogMode { + enum LogMode { /** * Player position */ diff --git a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java index 677ca5ecb..d0e5fc0c7 100644 --- a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java +++ b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java @@ -151,7 +151,7 @@ public class YAMLNode { return; } - if (o == null || !(o instanceof Map)) { + if (!(o instanceof Map)) { // This will override existing configuration data! o = new LinkedHashMap(); node.put(parts[i], o); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java index 0ac44dbff..5d6233f23 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -481,10 +481,10 @@ public class WorldEdit { int size = missingBlocks.size(); int i = 0; - for (BlockType id : missingBlocks.keySet()) { - str.append(id.getName()); + for (Map.Entry blockTypeIntegerEntry : missingBlocks.entrySet()) { + str.append((blockTypeIntegerEntry.getKey()).getName()); - str.append(" [Amt: ").append(missingBlocks.get(id)).append("]"); + str.append(" [Amt: ").append(blockTypeIntegerEntry.getValue()).append("]"); ++i; @@ -559,7 +559,7 @@ public class WorldEdit { Request.reset(); String filename = f.getPath(); - int index = filename.lastIndexOf("."); + int index = filename.lastIndexOf('.'); String ext = filename.substring(index + 1); if (!ext.equalsIgnoreCase("js")) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/metadata/MobType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/metadata/MobType.java index fbd28b32a..762f39715 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/metadata/MobType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/metadata/MobType.java @@ -55,7 +55,7 @@ public enum MobType { private final String name; - private MobType(String name) { + MobType(String name) { this.name = name; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java index edc6282a7..c3c7b827f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java @@ -32,7 +32,6 @@ import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.block.BlockReplace; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockTool.java index a4dd8e78f..139fbd640 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockTool.java @@ -27,5 +27,5 @@ import com.sk89q.worldedit.util.Location; public interface BlockTool extends Tool { - public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked); + boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionBlockTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionBlockTool.java index b44c82191..78f1a5f3e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionBlockTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionBlockTool.java @@ -30,6 +30,6 @@ import com.sk89q.worldedit.util.Location; */ public interface DoubleActionBlockTool extends BlockTool { - public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked); + boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionTraceTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionTraceTool.java index 708d3d9e9..dde9cca86 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionTraceTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DoubleActionTraceTool.java @@ -29,6 +29,6 @@ import com.sk89q.worldedit.extension.platform.Platform; */ public interface DoubleActionTraceTool extends TraceTool { - public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session); + boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java index 0522e8579..445c5e158 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java @@ -29,7 +29,6 @@ import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockTypes; /** * A tool that can place (or remove) blocks at a distance. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/Tool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/Tool.java index 85b8460fd..2ed73209f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/Tool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/Tool.java @@ -34,6 +34,6 @@ public interface Tool { * @param actor the actor * @return true if use is permitted */ - public boolean canUse(Actor actor); + boolean canUse(Actor actor); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TraceTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TraceTool.java index 3728cd862..f02801fa5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TraceTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TraceTool.java @@ -26,5 +26,5 @@ import com.sk89q.worldedit.extension.platform.Platform; public interface TraceTool extends Tool { - public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session); + boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java index 71e6ea608..0caf07dbe 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java @@ -38,6 +38,6 @@ public interface Brush { * @param size the size of the brush * @throws MaxChangedBlocksException */ - public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException; + void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java index aaa4b387e..f3e653827 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java @@ -33,7 +33,6 @@ import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java index c66203025..f0e8f1f25 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java @@ -35,7 +35,6 @@ import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java index b48e8d509..b7f43f363 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java @@ -21,7 +21,6 @@ package com.sk89q.worldedit.extent.inventory; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypes; /** * Represents a source to get blocks from and store removed ones. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java index b528c1c79..95af3d0c8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java @@ -26,7 +26,6 @@ import com.sk89q.worldedit.extent.Extent; 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 java.util.HashMap; import java.util.Map; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java index 52682bdca..52fe0af5e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java @@ -27,7 +27,6 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockTypes; /** * Makes changes to the world as if a player had done so during survival mode. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/EntityFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/EntityFunction.java index f7048cd1a..6bbb669f0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/EntityFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/EntityFunction.java @@ -34,6 +34,6 @@ public interface EntityFunction { * @return true if something was changed * @throws WorldEditException thrown on an error */ - public boolean apply(Entity entity) throws WorldEditException; + boolean apply(Entity entity) throws WorldEditException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionFunction.java index 9fb8284cc..41144fc8f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionFunction.java @@ -36,6 +36,6 @@ public interface FlatRegionFunction { * @return true if something was changed * @throws WorldEditException thrown on an error */ - public boolean apply(Vector2D position) throws WorldEditException; + boolean apply(Vector2D position) throws WorldEditException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java index 4f769dce4..91276d237 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java @@ -34,6 +34,6 @@ public interface RegionFunction { * @return true if something was changed * @throws WorldEditException thrown on an error */ - public boolean apply(Vector position) throws WorldEditException; + boolean apply(Vector position) throws WorldEditException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java index 07c4545fc..911b4ce69 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java @@ -21,7 +21,6 @@ package com.sk89q.worldedit.function.mask; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.world.block.BlockTypes; import javax.annotation.Nullable; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java index 45d495bbd..6a8d96ccf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java @@ -34,6 +34,6 @@ import java.lang.annotation.Target; @Target(ElementType.PARAMETER) public @interface Direction { - public static final String AIM = "me"; + String AIM = "me"; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/CUIEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/CUIEvent.java index 14f3f2c03..7d880f907 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/CUIEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/CUIEvent.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.internal.cui; public interface CUIEvent { - public String getTypeId(); + String getTypeId(); - public String[] getParameters(); + String[] getParameters(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/CUIRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/CUIRegion.java index 84b740e39..bd06908ac 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/CUIRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/CUIRegion.java @@ -30,7 +30,7 @@ public interface CUIRegion { * value supplied by getProtocolVersion(). * */ - public void describeCUI(LocalSession session, Actor player); + void describeCUI(LocalSession session, Actor player); /** * Sends CUI events describing the region for @@ -38,7 +38,7 @@ public interface CUIRegion { * supplied by getProtocolVersion(). * */ - public void describeLegacyCUI(LocalSession session, Actor player); + void describeLegacyCUI(LocalSession session, Actor player); /** * Returns the CUI version that is required to send @@ -47,14 +47,14 @@ public interface CUIRegion { * * @return the protocol version */ - public int getProtocolVersion(); + int getProtocolVersion(); /** * Returns the type ID to send to CUI in the selection event. * * @return the type ID */ - public String getTypeID(); + String getTypeID(); /** * Returns the type ID to send to CUI in the selection @@ -62,5 +62,5 @@ public interface CUIRegion { * * @return the legacy type ID */ - public String getLegacyTypeID(); + String getLegacyTypeID(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Identifiable.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Identifiable.java index b23ba38c4..3b82842ea 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Identifiable.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Identifiable.java @@ -54,8 +54,8 @@ public interface Identifiable { * C - Switch * */ - public abstract char id(); + char id(); - public int getPosition(); + int getPosition(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/LValue.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/LValue.java index a0f71cadf..338cc74b2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/LValue.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/LValue.java @@ -27,12 +27,12 @@ import com.sk89q.worldedit.internal.expression.parser.ParserException; */ public interface LValue extends RValue { - public double assign(double value) throws EvaluationException; + double assign(double value) throws EvaluationException; @Override - public LValue optimize() throws EvaluationException; + LValue optimize() throws EvaluationException; @Override - public LValue bindVariables(Expression expression, boolean preferLValue) throws ParserException; + LValue bindVariables(Expression expression, boolean preferLValue) throws ParserException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/RValue.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/RValue.java index c47c5c98f..45a654bcd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/RValue.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/RValue.java @@ -28,10 +28,10 @@ import com.sk89q.worldedit.internal.expression.parser.ParserException; */ public interface RValue extends Identifiable { - public double getValue() throws EvaluationException; + double getValue() throws EvaluationException; - public RValue optimize() throws EvaluationException; + RValue optimize() throws EvaluationException; - public RValue bindVariables(Expression expression, boolean preferLValue) throws ParserException; + RValue bindVariables(Expression expression, boolean preferLValue) throws ParserException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java index 4f9f130c9..4728bc9b8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java @@ -160,13 +160,13 @@ public final class DocumentationPrinter { stream.print(" || "); - if (cmd.flags() != null && !cmd.flags().equals("")) { + if (cmd.flags() != null && !cmd.flags().isEmpty()) { stream.print(cmd.flags()); } stream.print(" || "); - if (cmd.desc() != null && !cmd.desc().equals("")) { + if (cmd.desc() != null && !cmd.desc().isEmpty()) { stream.print(cmd.desc()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java index 89f0a8012..68df24b0d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java @@ -36,7 +36,7 @@ public interface Interpolation { * * @param nodes the nodes */ - public void setNodes(List nodes); + void setNodes(List nodes); /** * Gets the result of f(position) @@ -44,7 +44,7 @@ public interface Interpolation { * @param position the position to interpolate * @return the result */ - public Vector getPosition(double position); + Vector getPosition(double position); /** * Gets the result of f'(position). @@ -52,7 +52,7 @@ public interface Interpolation { * @param position the position to interpolate * @return the result */ - public Vector get1stDerivative(double position); + Vector get1stDerivative(double position); /** * Gets the result of ∫ab|f'(t)| dt.
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/FlatRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/FlatRegion.java index 39fc6dcf0..92cdf6e36 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/FlatRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/FlatRegion.java @@ -28,19 +28,19 @@ public interface FlatRegion extends Region { * * @return the Y value */ - public int getMinimumY(); + int getMinimumY(); /** * Gets the maximum Y value * * @return the Y value */ - public int getMaximumY(); + int getMaximumY(); /** * Get this region as an iterable flat region. * * @return a flat region iterable */ - public Iterable asFlatRegion(); + Iterable asFlatRegion(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java index 52329f86c..278ae4815 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java @@ -44,14 +44,14 @@ public interface RegionSelector { * @return a world, which may be null */ @Nullable - public World getWorld(); + World getWorld(); /** * Set the world for the region selector. * * @param world the world, which may be null */ - public void setWorld(@Nullable World world); + void setWorld(@Nullable World world); /** * Called when the first point is selected. @@ -59,7 +59,7 @@ public interface RegionSelector { * @param position the position * @return true if something changed */ - public boolean selectPrimary(Vector position, SelectorLimits limits); + boolean selectPrimary(Vector position, SelectorLimits limits); /** * Called when the second point is selected. @@ -67,7 +67,7 @@ public interface RegionSelector { * @param position the position * @return true if something changed */ - public boolean selectSecondary(Vector position, SelectorLimits limits); + boolean selectSecondary(Vector position, SelectorLimits limits); /** * Tell the player information about his/her primary selection. @@ -76,7 +76,7 @@ public interface RegionSelector { * @param session the session * @param position position */ - public void explainPrimarySelection(Actor actor, LocalSession session, Vector position); + void explainPrimarySelection(Actor actor, LocalSession session, Vector position); /** * Tell the player information about his/her secondary selection. @@ -85,7 +85,7 @@ public interface RegionSelector { * @param session the session * @param position position */ - public void explainSecondarySelection(Actor actor, LocalSession session, Vector position); + void explainSecondarySelection(Actor actor, LocalSession session, Vector position); /** * The the player information about the region's changes. This may resend @@ -94,7 +94,7 @@ public interface RegionSelector { * @param actor the actor * @param session the session */ - public void explainRegionAdjust(Actor actor, LocalSession session); + void explainRegionAdjust(Actor actor, LocalSession session); /** * Get the primary position. @@ -102,7 +102,7 @@ public interface RegionSelector { * @return the primary position * @throws IncompleteRegionException thrown if a region has not been fully defined */ - public BlockVector getPrimaryPosition() throws IncompleteRegionException; + BlockVector getPrimaryPosition() throws IncompleteRegionException; /** * Get the selection. @@ -110,51 +110,51 @@ public interface RegionSelector { * @return the created region * @throws IncompleteRegionException thrown if a region has not been fully defined */ - public Region getRegion() throws IncompleteRegionException; + Region getRegion() throws IncompleteRegionException; /** * Get the region even if it's not fully defined. * * @return an incomplete region object that is incomplete */ - public Region getIncompleteRegion(); + Region getIncompleteRegion(); /** * Returns whether the region has been fully defined. * * @return true if a selection is available */ - public boolean isDefined(); + boolean isDefined(); /** * Get the number of blocks inside the region. * * @return number of blocks, or -1 if undefined */ - public int getArea(); + int getArea(); /** * Update the selector with changes to the region. */ - public void learnChanges(); + void learnChanges(); /** * Clear the selection. */ - public void clear(); + void clear(); /** * Get a lowercase name of this region selector type. * * @return a lower case name of the type */ - public String getTypeName(); + String getTypeName(); /** * Get lines of information about the selection. * * @return a list of lines describing the region */ - public List getInformationLines(); + List getInformationLines(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/RegionSelectorType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/RegionSelectorType.java index 9ce56af45..03cae96a0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/RegionSelectorType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/RegionSelectorType.java @@ -36,7 +36,7 @@ public enum RegionSelectorType { private final Class selectorClass; - private RegionSelectorType(Class selectorClass) { + RegionSelectorType(Class selectorClass) { this.selectorClass = selectorClass; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptEngine.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptEngine.java index e86ae6efc..8f946800f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptEngine.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptEngine.java @@ -24,10 +24,10 @@ import java.util.Map; import javax.script.ScriptException; public interface CraftScriptEngine { - public void setTimeLimit(int milliseconds); + void setTimeLimit(int milliseconds); - public int getTimeLimit(); + int getTimeLimit(); - public Object evaluate(String script, String filename, Map args) + Object evaluate(String script, String filename, Map args) throws ScriptException, Throwable; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index 929085bd5..0f5166a81 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -104,7 +104,7 @@ public class SessionManager { checkNotNull(name); for (SessionHolder holder : sessions.values()) { String test = holder.key.getName(); - if (test != null && name.equals(test)) { + if (name.equals(test)) { return holder.session; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java index 27fce4979..be654ec17 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java @@ -22,7 +22,6 @@ package com.sk89q.worldedit.util; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.world.World; -import com.sk89q.worldedit.world.block.BlockTypes; /** * This class uses an inefficient method to figure out what block a player diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java index 84e0fc34e..41745a0aa 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java @@ -120,7 +120,7 @@ public class YAMLConfiguration extends LocalConfiguration { } String type = config.getString("shell-save-type", "").trim(); - shellSaveType = type.equals("") ? null : type; + shellSaveType = type.isEmpty() ? null : type; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/Parameter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/Parameter.java index 1952f6c56..a2ac4e343 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/Parameter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/Parameter.java @@ -61,6 +61,6 @@ public interface Parameter { * * @return a default value, or null if none is set */ - public String[] getDefaultValue(); + String[] getDefaultValue(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/Style.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/Style.java index e46e6a7a4..f705bb99a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/Style.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/Style.java @@ -136,11 +136,11 @@ public enum Style { private final static Map BY_ID = Maps.newHashMap(); private final static Map BY_CHAR = Maps.newHashMap(); - private Style(char code, int intCode) { + Style(char code, int intCode) { this(code, intCode, false); } - private Style(char code, int intCode, boolean isFormat) { + Style(char code, int intCode, boolean isFormat) { this.code = code; this.intCode = intCode; this.isFormat = isFormat; @@ -183,7 +183,7 @@ public enum Style { * Gets the color represented by the specified color code * * @param code Code to check - * @return Associative {@link org.bukkit.ChatColor} with the given code, or null if it doesn't exist + * @return Associative Style with the given code, or null if it doesn't exist */ public static Style getByChar(char code) { return BY_CHAR.get(code); @@ -193,7 +193,7 @@ public enum Style { * Gets the color represented by the specified color code * * @param code Code to check - * @return Associative {@link org.bukkit.ChatColor} with the given code, or null if it doesn't exist + * @return Associative Style with the given code, or null if it doesn't exist */ public static Style getByChar(String code) { checkNotNull(code); 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 ed9261e64..aa3100326 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 @@ -25,7 +25,6 @@ import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.blocks.TileEntityBlock; -import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.registry.state.Property; import java.util.Map; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java index 6b9cafcb5..d3ca0c251 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java @@ -200,7 +200,7 @@ public class Snapshot implements Comparable { public int compareTo(Snapshot o) { if (o.date == null || date == null) { // Remove the folder from the name - int i = name.indexOf("/"), j = o.name.indexOf("/"); + int i = name.indexOf('/'), j = o.name.indexOf('/'); return name.substring((i > 0 ? 0 : i)).compareTo(o.name.substring((j > 0 ? 0 : j))); } else { return date.compareTo(o.date); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotDateParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotDateParser.java index 0c1887e37..323bef842 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotDateParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotDateParser.java @@ -36,6 +36,6 @@ public interface SnapshotDateParser { * @return date or null */ @Nullable - public Calendar detectDate(File file); + Calendar detectDate(File file); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/TrueZipLegacyChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/TrueZipLegacyChunkStore.java index 33e59f590..ea5cf9f9c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/TrueZipLegacyChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/TrueZipLegacyChunkStore.java @@ -88,7 +88,7 @@ public class TrueZipLegacyChunkStore extends LegacyChunkStore { // Detect subfolder for the world's files if (folder != null) { - if (!folder.equals("")) { + if (!folder.isEmpty()) { file = folder + "/" + file; } } else { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/TrueZipMcRegionChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/TrueZipMcRegionChunkStore.java index cc5378a4e..a22818c77 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/TrueZipMcRegionChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/TrueZipMcRegionChunkStore.java @@ -87,7 +87,7 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore { protected InputStream getInputStream(String name, String worldName) throws IOException, DataException { // Detect subfolder for the world's files if (folder != null) { - if (!folder.equals("")) { + if (!folder.isEmpty()) { name = folder + "/" + name; } } else { @@ -100,7 +100,7 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore { if (worldPattern.matcher(worldName).matches()) { // Check for file if (pattern.matcher(testEntry.getName()).matches()) { - folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf("/")); + folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf('/')); name = folder + "/" + name; break; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java index 967e456ac..19350d831 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java @@ -82,7 +82,7 @@ public class ZippedLegacyChunkStore extends LegacyChunkStore { // Detect subfolder for the world's files if (folder != null) { - if (!folder.equals("")) { + if (!folder.isEmpty()) { file = folder + "/" + file; } } else { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java index e8979d06c..581686ea4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java @@ -76,7 +76,7 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore { protected InputStream getInputStream(String name, String worldName) throws IOException, DataException { // Detect subfolder for the world's files if (folder != null) { - if (!folder.equals("")) { + if (!folder.isEmpty()) { name = folder + "/" + name; } } else { @@ -86,7 +86,7 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore { // Check for world if (testEntry.getName().startsWith(worldName + "/")) { if (pattern.matcher(testEntry.getName()).matches()) { // does entry end in .mca - folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf("/")); + folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf('/')); name = folder + "/" + name; break; } From fdb9d77710379e955c2fbbe0386efdc816f5ccd1 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 28 Aug 2018 18:45:24 +1000 Subject: [PATCH 7/7] Finish the BlockData caching in Bukkit --- .../java/com/sk89q/worldedit/bukkit/BukkitAdapter.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java index f7500168a..7b0aa4ff6 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java @@ -345,6 +345,8 @@ public class BukkitAdapter { }); } + private static Map blockDataCache = new HashMap<>(); + /** * Create a Bukkit BlockData from a WorldEdit BlockStateHolder * @@ -353,7 +355,13 @@ public class BukkitAdapter { */ public static BlockData adapt(BlockStateHolder block) { checkNotNull(block); - return Bukkit.createBlockData(block.getAsString()); + return blockDataCache.computeIfAbsent(block.getAsString(), new Function() { + @Nullable + @Override + public BlockData apply(@Nullable String input) { + return Bukkit.createBlockData(block.getAsString()); + } + }).clone(); } /**