Mob De-spawn help

Discussion in 'Spigot Plugin Development' started by Eliminator, May 30, 2015.

  1. In my plugin I save entities to a list, then loop through them later to do stuff with them.

    Before I use them I check
    Code (Text):
    if((!mob.isDead()) && (mob.getLocation() != null))
    But sometimes the mob has de-spawned or something, and those return true when its actually gone.

    How do I check if the mob is dead/gone with 100% accuracy?
    #1 Eliminator, May 30, 2015
    Last edited: May 30, 2015
  2. You didn't really put a question in.. Just a series of statements :p I'm guessing that you are asking how you can prevent de-spawns? If so, look into the CreatureDespawnEvent in Spigot
  3. No, I'm asking how to check if the mob is dead/gone with 100% accuracy.
  4. Have you tried Entity#isValid()?