From 3a2451e551ec693699c22f1afd9da0a17efa6c5b Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 8 Mar 2017 19:18:59 +1100 Subject: [PATCH] Fix hand/pos1 not respecting blacklist --- .../main/java/com/boydti/fawe/FaweCache.java | 1 - .../extension/factory/DefaultBlockParser.java | 26 ++++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/FaweCache.java b/core/src/main/java/com/boydti/fawe/FaweCache.java index 70bfbd98..f2646583 100644 --- a/core/src/main/java/com/boydti/fawe/FaweCache.java +++ b/core/src/main/java/com/boydti/fawe/FaweCache.java @@ -570,7 +570,6 @@ public class FaweCache { case 56: case 57: case 58: - case 60: case 7: case 11: case 73: diff --git a/core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java b/core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java index 3255509f..5753c0e7 100644 --- a/core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java +++ b/core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java @@ -129,18 +129,17 @@ public class DefaultBlockParser extends InputParser { int data = -1; + CompoundTag nbt = null; + boolean parseDataValue = true; if ("hand".equalsIgnoreCase(testId)) { // Get the block type from the item in the user's hand. final BaseBlock blockInHand = getBlockInHand(context.requireActor()); - if (blockInHand.getClass() != BaseBlock.class) { - return blockInHand; - } - blockId = blockInHand.getId(); blockType = BlockType.fromID(blockId); data = blockInHand.getData(); + nbt = blockInHand.getNbtData(); } else if ("pos1".equalsIgnoreCase(testId)) { // Get the block type from the "primary position" final World world = context.requireWorld(); @@ -151,13 +150,10 @@ public class DefaultBlockParser extends InputParser { throw new InputParseException("Your selection is not complete."); } final BaseBlock blockInHand = world.getBlock(primaryPosition); - if (blockInHand.getClass() != BaseBlock.class) { - return blockInHand; - } - blockId = blockInHand.getId(); blockType = BlockType.fromID(blockId); data = blockInHand.getData(); + nbt = blockInHand.getNbtData(); } else { // Attempt to parse the item ID or otherwise resolve an item/block // name to its numeric ID @@ -332,17 +328,17 @@ public class DefaultBlockParser extends InputParser { if (blockAndExtraData.length > 1 && blockAndExtraData[1].startsWith("{")) { String joined = StringMan.join(Arrays.copyOfRange(blockAndExtraData, 1, blockAndExtraData.length), "|"); try { - CompoundTag nbt = JSON2NBT.getTagFromJson(joined); - if (nbt != null) { - if (context.isRestricted() && actor != null && !actor.hasPermission("worldedit.anyblock")) { - throw new DisallowedUsageException("You are not allowed to nbt'"); - } - return new BaseBlock(blockId, data, nbt); - } + nbt = JSON2NBT.getTagFromJson(joined); } catch (NBTException e) { throw new NoMatchException(e.getMessage()); } } + if (nbt != null) { + if (context.isRestricted() && actor != null && !actor.hasPermission("worldedit.anyblock")) { + throw new DisallowedUsageException("You are not allowed to nbt'"); + } + return new BaseBlock(blockId, data, nbt); + } switch (blockType) { case SIGN_POST: