An event for when an entity despawns?


I’m quite new to Sponge and I’ve taken it upon myself to learn the API by creating some mock plugins. First thing I wanted to do was recreate the functionality of Citizens, since I felt it would be a good way to get familiar with the way Sponge deals with Entities and all that.

One of the first issues I’ve run into is that Entities ( including Human ones ) disappear if there isn’t a player close enough. I haven’t measured the range or anything, and I’m presuming this is common knowledge, not reporting a bug or anything here.

I was just wondering if there was an event in the API I’ve failed to notice that could help me handle this despawning behavior?

Does DestructEntityEvent fire for that?

No, I’ve just tested it, and it doesn’t appear to. When killing an entity it does, but when I fly away and the entity despawns, it doesn’t seem to ( I set up a logger to log when the event happens but it only triggered when I killed a mob ).

File a ticket on the SpongeAPI github then.