From fc949e3efcc1d4458a68e3ec548d43b12ab8dc57 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 8 Sep 2018 03:11:56 +1000 Subject: [PATCH] Fixes #1112 --- .../listener/AsyncTabCompleteListener.java | 18 ------------------ .../sk89q/worldedit/command/BrushCommands.java | 7 ++++--- .../worldedit/world/chunk/AnvilChunk13.java | 13 +++++++------ 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/AsyncTabCompleteListener.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/AsyncTabCompleteListener.java index 581729fd0..d0da7104a 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/AsyncTabCompleteListener.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/AsyncTabCompleteListener.java @@ -27,22 +27,4 @@ public class AsyncTabCompleteListener extends ATabCompleteListener { } } } - - // Fix for the event being borked with paper - private List completions = null; - private CommandSender sender; - - @EventHandler - public void onTabComplete(TabCompleteEvent event) { - if (event.isCommand()) { - if (sender == event.getSender()) { - event.setCompletions(completions); - sender = null; - } else { - sender = event.getSender(); - completions = event.getCompletions(); - event.setCompletions(Collections.emptyList()); - } - } - } } \ No newline at end of file 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 34f1e4e05..9a263fd6e 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 @@ -354,7 +354,7 @@ public class BrushCommands extends BrushProcessor { InputStream stream = getHeightmapStream(image); HeightBrush brush; try { - brush = new StencilBrush(stream, rotation, yscale, onlyWhite, image.equalsIgnoreCase("#clipboard") ? session.getClipboard().getClipboard() : null); + brush = new StencilBrush(stream, rotation, yscale, onlyWhite, "#clipboard".equalsIgnoreCase(image) ? session.getClipboard().getClipboard() : null); } catch (EmptyClipboardException ignore) { brush = new StencilBrush(stream, rotation, yscale, onlyWhite, null); } @@ -735,13 +735,13 @@ public class BrushCommands extends BrushProcessor { HeightBrush brush; if (flat) { try { - brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, image.equalsIgnoreCase("#clipboard") ? session.getClipboard().getClipboard() : null, shape); + brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, "#clipboard".equalsIgnoreCase(image) ? session.getClipboard().getClipboard() : null, shape); } catch (EmptyClipboardException ignore) { brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, null, shape); } } else { try { - brush = new HeightBrush(stream, rotation, yscale, layers, smooth, image.equalsIgnoreCase("#clipboard") ? session.getClipboard().getClipboard() : null); + brush = new HeightBrush(stream, rotation, yscale, layers, smooth, "#clipboard".equalsIgnoreCase(image) ? session.getClipboard().getClipboard() : null); } catch (EmptyClipboardException ignore) { brush = new HeightBrush(stream, rotation, yscale, layers, smooth, null); } @@ -755,6 +755,7 @@ public class BrushCommands extends BrushProcessor { } private InputStream getHeightmapStream(String filename) throws FileNotFoundException, ParameterException { + if (filename == null) return null; String filenamePng = (filename.endsWith(".png") ? filename : filename + ".png"); File file = new File(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP + File.separator + filenamePng); if (file.exists()) return new FileInputStream(file); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java index 1f673ab6b..631e57962 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java @@ -28,8 +28,8 @@ import com.sk89q.jnbt.NBTUtils; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; @@ -230,7 +230,7 @@ public class AnvilChunk13 implements Chunk { } @Override - public BaseBlock getBlock(Vector position) throws DataException { + public BlockState getBlock(Vector position) throws DataException { int x = position.getBlockX() - rootX * 16; int y = position.getBlockY(); int z = position.getBlockZ() - rootZ * 16; @@ -244,10 +244,11 @@ public class AnvilChunk13 implements Chunk { BlockState[] sectionBlocks = blocks[section]; BlockState state = sectionBlocks != null ? sectionBlocks[(yIndex << 8) | (z << 4) | x] : BlockTypes.AIR.getDefaultState(); - - CompoundTag tileEntity = getBlockTileEntity(position); - - return state.toBaseBlock(tileEntity); + if (state.getMaterial().hasContainer()) { + CompoundTag tileEntity = getBlockTileEntity(position); + if (tileEntity != null) return new BaseBlock(state, tileEntity); + } + return state; } }