[Question] How did you prevent pet despawning in mob disabled areas
davidjm6 opened this issue ยท 4 comments
We use a combination of EchoPet and Towny on our server. When a hostile mob enters an area that was claimed by towny, the mob typically despawns. However, the pets in EchoPet DONT despawn.
I tried looking through your source code, and I can't figure out how you accomplished this. Could you please help me? I'm writing my own plugin, and having this ability would be a huge asset.
Thanks.
These two event listeners do the trick. It was originally intended to override WorldGuard flags, but I'm glad to hear it works in Towny too :D
hmm. didn't work.
After looking into your code and towny's code a bit more, I think I've figured out why pets don't despawn.
In the EchoPet plugin, custom entities are created of type IEntityPet/PetType/EntityPetType (not really sure which). Towny automatically despawns anything it classifies as a "Monster" which is any hostile mob defined in vanilla minecraft. Because a Spider Pet has the type ISpiderPet it is not read in as a typical spider and therefore not defined as being a Monster.
So now I just need to figure out how the heck to create a custom mob type XD. Any tips on doing so?
Never mind. It was an issue in my code. Had a true where there should have been a false.
Thanks for you help! So much more helpful than the towny dev I was working with XD