From 330523bac4a173e88e30f59a7d7000b690a6d2c1 Mon Sep 17 00:00:00 2001 From: Wyatt Childers Date: Sat, 16 Apr 2016 17:18:48 -0400 Subject: [PATCH] A BlockSnapot does not always have a location in the InteractBlockEvent --- .../java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java index e9a8fa208..6c9cac5f0 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java @@ -154,7 +154,13 @@ public class SpongeWorldEdit { com.sk89q.worldedit.world.World world = player.getWorld(); BlockSnapshot targetBlock = event.getTargetBlock(); - Location loc = targetBlock.getLocation().get(); + Optional> optLoc = targetBlock.getLocation(); + + if (!optLoc.isPresent()) { + return; + } + + Location loc = optLoc.get(); BlockType interactedType = targetBlock.getState().getType(); if (event instanceof InteractBlockEvent.Primary) {