From cc70f18bef03958c5c46583104d41e4fa0afb216 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 1 Dec 2021 08:26:14 +1100 Subject: [PATCH] SPIGOT-6820: VillagerCareerChangeEvent's ChangeReason is sometimes incorrect By: Doc --- .../minecraft/world/entity/ai/behavior/BehaviorProfession.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paper-server/nms-patches/net/minecraft/world/entity/ai/behavior/BehaviorProfession.patch b/paper-server/nms-patches/net/minecraft/world/entity/ai/behavior/BehaviorProfession.patch index 3b30b6656f..0c286d7930 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/ai/behavior/BehaviorProfession.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/ai/behavior/BehaviorProfession.patch @@ -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; + }