From c3ce162fd5cf1cf0d19ed664ace6570ebb707fb0 Mon Sep 17 00:00:00 2001 From: Bernhard Date: Sun, 11 Dec 2022 18:36:33 +0100 Subject: [PATCH] Feature: add "h" as alias for "hand" and "oh" for "offhand" (#2033) --- .../extension/factory/parser/DefaultBlockParser.java | 4 ++-- .../worldedit/extension/factory/parser/DefaultItemParser.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java index 4d8523f84..b11926db8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java @@ -408,14 +408,14 @@ public class DefaultBlockParser extends InputParser { TextComponent.of(blockAndExtraData[0]) )); } - if ("hand".equalsIgnoreCase(typeString)) { + if ("hand".equalsIgnoreCase(typeString) || "h".equalsIgnoreCase(typeString)) { // Get the block type from the item in the user's hand. final BaseBlock blockInHand = getBlockInHand(context.requireActor(), HandSide.MAIN_HAND); //FAWE start state = blockInHand.toBlockState(); nbt = blockInHand.getNbtData(); //FAWE end - } else if ("offhand".equalsIgnoreCase(typeString)) { + } else if ("offhand".equalsIgnoreCase(typeString) || "oh".equalsIgnoreCase(typeString)) { // Get the block type from the item in the user's off hand. final BaseBlock blockInHand = getBlockInHand(context.requireActor(), HandSide.OFF_HAND); //FAWE start diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java index 0f22d0b93..b889d4dca 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java @@ -106,13 +106,13 @@ public class DefaultItemParser extends InputParser { nbtString = input.substring(nbtStart); } - if ("hand".equalsIgnoreCase(typeString)) { + if ("hand".equalsIgnoreCase(typeString) || "h".equalsIgnoreCase(typeString)) { BaseItemStack heldItem = getItemInHand(context.requireActor(), HandSide.MAIN_HAND); //FAWE start itemType = heldItem.getType(); itemNbtData = heldItem.getNbt(); //FAWE end - } else if ("offhand".equalsIgnoreCase(typeString)) { + } else if ("offhand".equalsIgnoreCase(typeString) || "oh".equalsIgnoreCase(typeString)) { BaseItemStack heldItem = getItemInHand(context.requireActor(), HandSide.OFF_HAND); //FAWE start itemType = heldItem.getType();