Release POIs when villagers are removed by plugins

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2021-12-03 15:05:20 +11:00
parent ea74321d65
commit 05d379a339
2 changed files with 16 additions and 0 deletions

View file

@ -58,6 +58,15 @@
Logger logger = EntityVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -630,7 +645,7 @@
super.die(damagesource);
}
- private void releaseAllPois() {
+ public void releaseAllPois() {
this.releasePoi(MemoryModuleType.HOME);
this.releasePoi(MemoryModuleType.JOB_SITE);
this.releasePoi(MemoryModuleType.POTENTIAL_JOB_SITE);
@@ -816,7 +831,12 @@
}

View file

@ -38,6 +38,13 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
return EntityType.VILLAGER;
}
@Override
public void remove() {
getHandle().releaseAllPois();
super.remove();
}
@Override
public Profession getProfession() {
return CraftVillager.nmsToBukkitProfession(getHandle().getVillagerData().getProfession());