diff --git a/src/main/java/org/kitteh/vanish/listeners/ListenEntity.java b/src/main/java/org/kitteh/vanish/listeners/ListenEntity.java index 01ca895..d364b0d 100644 --- a/src/main/java/org/kitteh/vanish/listeners/ListenEntity.java +++ b/src/main/java/org/kitteh/vanish/listeners/ListenEntity.java @@ -22,6 +22,7 @@ import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockReceiveGameEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityTargetEvent; @@ -85,4 +86,13 @@ public void onVehicleEntityCollision(@NonNull VehicleEntityCollisionEvent event) event.setCancelled(true); } } + + @EventHandler(ignoreCancelled = true) + public void onBlockReceiveGameEvent(@NonNull BlockReceiveGameEvent event) { + if (event.getEntity() instanceof Player player) { + if (this.plugin.getManager().isVanished(player)) { + event.setCancelled(true); + } + } + } }