Fixed NotABlockException not getting thrown

Dieser Commit ist enthalten in:
Matthew Miller 2018-08-19 14:41:09 +10:00
Ursprung 034c165bee
Commit 7b83f97c35
2 geänderte Dateien mit 6 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -22,8 +22,10 @@ package com.sk89q.worldedit.bukkit;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.sk89q.worldedit.NotABlockException;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.InputParseException;
@ -360,12 +362,12 @@ public class BukkitAdapter {
* @param itemStack The Bukkit ItemStack * @param itemStack The Bukkit ItemStack
* @return The WorldEdit BlockState * @return The WorldEdit BlockState
*/ */
public static BlockState asBlockState(ItemStack itemStack) { public static BlockState asBlockState(ItemStack itemStack) throws WorldEditException {
checkNotNull(itemStack); checkNotNull(itemStack);
if (itemStack.getType().isBlock()) { if (itemStack.getType().isBlock()) {
return adapt(itemStack.getType().createBlockData()); return adapt(itemStack.getType().createBlockData());
} else { } else {
return BlockTypes.AIR.getDefaultState(); throw new NotABlockException();
} }
} }

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.platform; package com.sk89q.worldedit.extension.platform;
import com.sk89q.worldedit.NotABlockException;
import com.sk89q.worldedit.PlayerDirection; import com.sk89q.worldedit.PlayerDirection;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
@ -370,7 +371,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
if (typeId.hasBlockType()) { if (typeId.hasBlockType()) {
return typeId.getBlockType().getDefaultState().toBaseBlock(); return typeId.getBlockType().getDefaultState().toBaseBlock();
} else { } else {
return BlockTypes.AIR.getDefaultState().toBaseBlock(); throw new NotABlockException();
} }
} }