Fix hand/pos1 not respecting blacklist
This commit is contained in:
parent
8618a00083
commit
3a2451e551
@ -570,7 +570,6 @@ public class FaweCache {
|
|||||||
case 56:
|
case 56:
|
||||||
case 57:
|
case 57:
|
||||||
case 58:
|
case 58:
|
||||||
case 60:
|
|
||||||
case 7:
|
case 7:
|
||||||
case 11:
|
case 11:
|
||||||
case 73:
|
case 73:
|
||||||
|
@ -129,18 +129,17 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
|||||||
|
|
||||||
int data = -1;
|
int data = -1;
|
||||||
|
|
||||||
|
CompoundTag nbt = null;
|
||||||
|
|
||||||
boolean parseDataValue = true;
|
boolean parseDataValue = true;
|
||||||
|
|
||||||
if ("hand".equalsIgnoreCase(testId)) {
|
if ("hand".equalsIgnoreCase(testId)) {
|
||||||
// Get the block type from the item in the user's hand.
|
// Get the block type from the item in the user's hand.
|
||||||
final BaseBlock blockInHand = getBlockInHand(context.requireActor());
|
final BaseBlock blockInHand = getBlockInHand(context.requireActor());
|
||||||
if (blockInHand.getClass() != BaseBlock.class) {
|
|
||||||
return blockInHand;
|
|
||||||
}
|
|
||||||
|
|
||||||
blockId = blockInHand.getId();
|
blockId = blockInHand.getId();
|
||||||
blockType = BlockType.fromID(blockId);
|
blockType = BlockType.fromID(blockId);
|
||||||
data = blockInHand.getData();
|
data = blockInHand.getData();
|
||||||
|
nbt = blockInHand.getNbtData();
|
||||||
} else if ("pos1".equalsIgnoreCase(testId)) {
|
} else if ("pos1".equalsIgnoreCase(testId)) {
|
||||||
// Get the block type from the "primary position"
|
// Get the block type from the "primary position"
|
||||||
final World world = context.requireWorld();
|
final World world = context.requireWorld();
|
||||||
@ -151,13 +150,10 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
|||||||
throw new InputParseException("Your selection is not complete.");
|
throw new InputParseException("Your selection is not complete.");
|
||||||
}
|
}
|
||||||
final BaseBlock blockInHand = world.getBlock(primaryPosition);
|
final BaseBlock blockInHand = world.getBlock(primaryPosition);
|
||||||
if (blockInHand.getClass() != BaseBlock.class) {
|
|
||||||
return blockInHand;
|
|
||||||
}
|
|
||||||
|
|
||||||
blockId = blockInHand.getId();
|
blockId = blockInHand.getId();
|
||||||
blockType = BlockType.fromID(blockId);
|
blockType = BlockType.fromID(blockId);
|
||||||
data = blockInHand.getData();
|
data = blockInHand.getData();
|
||||||
|
nbt = blockInHand.getNbtData();
|
||||||
} else {
|
} else {
|
||||||
// Attempt to parse the item ID or otherwise resolve an item/block
|
// Attempt to parse the item ID or otherwise resolve an item/block
|
||||||
// name to its numeric ID
|
// name to its numeric ID
|
||||||
@ -332,17 +328,17 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
|||||||
if (blockAndExtraData.length > 1 && blockAndExtraData[1].startsWith("{")) {
|
if (blockAndExtraData.length > 1 && blockAndExtraData[1].startsWith("{")) {
|
||||||
String joined = StringMan.join(Arrays.copyOfRange(blockAndExtraData, 1, blockAndExtraData.length), "|");
|
String joined = StringMan.join(Arrays.copyOfRange(blockAndExtraData, 1, blockAndExtraData.length), "|");
|
||||||
try {
|
try {
|
||||||
CompoundTag nbt = JSON2NBT.getTagFromJson(joined);
|
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);
|
|
||||||
}
|
|
||||||
} catch (NBTException e) {
|
} catch (NBTException e) {
|
||||||
throw new NoMatchException(e.getMessage());
|
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) {
|
switch (blockType) {
|
||||||
case SIGN_POST:
|
case SIGN_POST:
|
||||||
|
Loading…
Reference in New Issue
Block a user