A BlockSnapot does not always have a location in the InteractBlockEvent

This commit is contained in:
Wyatt Childers 2016-04-16 17:18:48 -04:00
parent a50e337224
commit 330523bac4

View File

@ -154,7 +154,13 @@ public class SpongeWorldEdit {
com.sk89q.worldedit.world.World world = player.getWorld();
BlockSnapshot targetBlock = event.getTargetBlock();
Location<World> loc = targetBlock.getLocation().get();
Optional<Location<World>> optLoc = targetBlock.getLocation();
if (!optLoc.isPresent()) {
return;
}
Location<World> loc = optLoc.get();
BlockType interactedType = targetBlock.getState().getType();
if (event instanceof InteractBlockEvent.Primary) {