Check for the root cause instead of the source when handling the InteractBlockEvent

Dieser Commit ist enthalten in:
Wyatt Childers 2016-05-01 13:39:09 -04:00
Ursprung 96798bbb90
Commit 2fd5c2f887

Datei anzeigen

@ -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<Player> 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();