summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/bukkit/entity/LivingEntity.java9
-rw-r--r--src/test/java/org/bukkit/plugin/messaging/TestPlayer.java4
2 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 6787d79a..e93453a3 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -269,4 +269,13 @@ public interface LivingEntity extends Entity {
* @return A collection of {@link PotionEffect}s
*/
public Collection<PotionEffect> getActivePotionEffects();
+
+ /**
+ * Checks whether the entity has block line of sight to another.<br />
+ * This uses the same algorithm that hostile mobs use to find the closest player.
+ *
+ * @param other The entity to determine line of sight to.
+ * @return true if there is a line of sight, false if not.
+ */
+ public boolean hasLineOfSight(Entity other);
}
diff --git a/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java b/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java
index 4a4032b6..15e60c14 100644
--- a/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java
+++ b/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java
@@ -756,4 +756,8 @@ public class TestPlayer implements Player {
public boolean isBlocking() {
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ public boolean hasLineOfSight(Entity other) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}