From 2fd5c2f887d3d4287767a9d725ab35a88a19a90a Mon Sep 17 00:00:00 2001 From: Wyatt Childers Date: Sun, 1 May 2016 13:39:09 -0400 Subject: [PATCH] Check for the root cause instead of the source when handling the InteractBlockEvent --- .../java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 27a2291b7..7b241cbd4 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 @@ -149,12 +149,12 @@ public class SpongeWorldEdit { if (!platform.isHookingEvents()) return; // We have to be told to catch these events WorldEdit we = WorldEdit.getInstance(); - Optional optPlayer = event.getCause().get(NamedCause.SOURCE, Player.class); - if (!optPlayer.isPresent()) { + Object rootObj = event.getCause().root(); + if (!(rootObj instanceof Player)) { return; } - SpongePlayer player = wrapPlayer(optPlayer.get()); + SpongePlayer player = wrapPlayer((Player) rootObj); com.sk89q.worldedit.world.World world = player.getWorld(); BlockSnapshot targetBlock = event.getTargetBlock();