mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-21 04:49:51 +08:00
Fixed NotABlockException not getting thrown
This commit is contained in:
parent
034c165bee
commit
7b83f97c35
@ -22,8 +22,10 @@
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.sk89q.worldedit.NotABlockException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
@ -360,12 +362,12 @@ public static BlockData adapt(BlockStateHolder block) {
|
||||
* @param itemStack The Bukkit ItemStack
|
||||
* @return The WorldEdit BlockState
|
||||
*/
|
||||
public static BlockState asBlockState(ItemStack itemStack) {
|
||||
public static BlockState asBlockState(ItemStack itemStack) throws WorldEditException {
|
||||
checkNotNull(itemStack);
|
||||
if (itemStack.getType().isBlock()) {
|
||||
return adapt(itemStack.getType().createBlockData());
|
||||
} else {
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
throw new NotABlockException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.platform;
|
||||
|
||||
import com.sk89q.worldedit.NotABlockException;
|
||||
import com.sk89q.worldedit.PlayerDirection;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@ -370,7 +371,7 @@ public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException {
|
||||
if (typeId.hasBlockType()) {
|
||||
return typeId.getBlockType().getDefaultState().toBaseBlock();
|
||||
} else {
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
throw new NotABlockException();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user