mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Check for the root cause instead of the source when handling the InteractBlockEvent
This commit is contained in:
parent
96798bbb90
commit
2fd5c2f887
@ -149,12 +149,12 @@ public class SpongeWorldEdit {
|
|||||||
if (!platform.isHookingEvents()) return; // We have to be told to catch these events
|
if (!platform.isHookingEvents()) return; // We have to be told to catch these events
|
||||||
|
|
||||||
WorldEdit we = WorldEdit.getInstance();
|
WorldEdit we = WorldEdit.getInstance();
|
||||||
Optional<Player> optPlayer = event.getCause().get(NamedCause.SOURCE, Player.class);
|
Object rootObj = event.getCause().root();
|
||||||
if (!optPlayer.isPresent()) {
|
if (!(rootObj instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpongePlayer player = wrapPlayer(optPlayer.get());
|
SpongePlayer player = wrapPlayer((Player) rootObj);
|
||||||
com.sk89q.worldedit.world.World world = player.getWorld();
|
com.sk89q.worldedit.world.World world = player.getWorld();
|
||||||
|
|
||||||
BlockSnapshot targetBlock = event.getTargetBlock();
|
BlockSnapshot targetBlock = event.getTargetBlock();
|
||||||
|
Loading…
Reference in New Issue
Block a user