summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2012-12-04 18:33:44 -0600
committerTravis Watkins <amaranth@ubuntu.com>2012-12-04 20:10:23 -0600
commit4dadf0e2b5ecb7a2644e2feb71e3a7ab1194ec84 (patch)
treefc546653d44e31e997b7bfb537e33793eea5ce82 /src/main/java/org/bukkit
parent11894784b06fa8559864932f46582e24c96bf45c (diff)
downloadcraftbukkit-4dadf0e2b5ecb7a2644e2feb71e3a7ab1194ec84.tar
craftbukkit-4dadf0e2b5ecb7a2644e2feb71e3a7ab1194ec84.tar.gz
craftbukkit-4dadf0e2b5ecb7a2644e2feb71e3a7ab1194ec84.tar.lz
craftbukkit-4dadf0e2b5ecb7a2644e2feb71e3a7ab1194ec84.tar.xz
craftbukkit-4dadf0e2b5ecb7a2644e2feb71e3a7ab1194ec84.zip
Implement API for mob despawn when away from players. Adds BUKKIT-2986
As of 1.4 mobs have a flag to determine if they despawn when away from a player or not. Unfortunately animals still use their own system to prevent despawning instead of making use of this flag. This change modifies them to use the new system (defaults to true) and to add API for plugins to adjust this.
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 096de373..a6cbc3d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -303,4 +303,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public boolean hasLineOfSight(Entity other) {
return getHandle().aA().canSee(((CraftEntity) other).getHandle()); // az should be getEntitySenses
}
+
+ public boolean getRemoveWhenFarAway() {
+ return !getHandle().persistent;
+ }
+
+ public void setRemoveWhenFarAway(boolean remove) {
+ getHandle().persistent = !remove;
+ }
}