/** * Set the tool. * * @param item the item type * @param tool the tool to set, which can be {@code null} * @throws InvalidToolBindException if the item can't be bound to that item */ public void setTool(ItemType item, @Nullable Tool tool) throws InvalidToolBindException { if (item.hasBlockType()) { throw new InvalidToolBindException(item, "Blocks can't be used"); } else if (item == ItemTypes.get(config.wandItem)) { throw new InvalidToolBindException(item, "Already used for the wand"); } else if (item == ItemTypes.get(config.navigationWand)) { throw new InvalidToolBindException(item, "Already used for the navigation wand"); } this.tools.put(item, tool); }
@Override public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException { final ItemType typeId = getItemInHand(handSide).getType(); if (typeId.hasBlockType()) { return typeId.getBlockType().getDefaultState().toBaseBlock(); } else { throw new NotABlockException(); } }
if (blocksOnly && !searchType.hasBlockType()) { continue; if (itemsOnly && searchType.hasBlockType()) { continue;