SPIGOT-6820: VillagerCareerChangeEvent's ChangeReason is sometimes incorrect

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot 2021-12-01 08:26:14 +11:00
parent 2492a39911
commit cc70f18bef

View File

@ -19,7 +19,7 @@
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(VillagerProfession.NONE));
+ // CraftBukkit start
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE), VillagerCareerChangeEvent.ChangeReason.LOSING_JOB);
+ if (event.isCancelled()) {
+ return;
+ }