Mark entities as invalid when they get despawned. Addresses BUKKIT-810

This commit is contained in:
Travis Watkins 2012-06-25 03:24:53 -05:00
parent f5b6abfae1
commit a21f038fc3
3 changed files with 7 additions and 0 deletions

View file

@ -143,6 +143,7 @@ public abstract class Entity {
public boolean cd;
public boolean ce;
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
public boolean valid = true; // CraftBukkit
public Entity(World world) {
this.id = entityCount++;

View file

@ -929,6 +929,8 @@ public class World implements IBlockAccess {
for (int i = 0; i < this.u.size(); ++i) {
((IWorldAccess) this.u.get(i)).b(entity);
}
entity.valid = false; // CraftBukkit
}
public void kill(Entity entity) {

View file

@ -212,6 +212,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return !entity.isAlive();
}
public boolean isValid() {
return entity.isAlive() && entity.valid;
}
public Server getServer() {
return server;
}