Remove NPC reference to Factory on death

This commit is contained in:
simon 2018-01-03 19:22:45 -05:00
parent 9b908a5310
commit 9bc3cbf4ce

View File

@ -41,15 +41,17 @@ public class HarvesterNPC extends NonPlayerCharacter {
//Self-destroy when age limit is reached
if (getAge() >= NonPlayerCharacter.LIFETIME) {
setDead(true);
getFactory().getNpcs().remove(this);
}
}
}
@Override
public void onDeadCallback() {
getFactory().getNpcs().remove(this);
GameServer.INSTANCE.getEventDispatcher().dispatch(
new ObjectDeathEvent((Object)this, ID));
new ObjectDeathEvent(this, ID));
}
@Override