Skip to content

Commit

Permalink
A BlockSnapot does not always have a location in the InteractBlockEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkArc committed Apr 16, 2016
1 parent a50e337 commit 330523b
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -154,7 +154,13 @@ public void onPlayerInteract(InteractBlockEvent event) {
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) {
Expand Down

0 comments on commit 330523b

Please sign in to comment.