--- a/net/minecraft/world/entity/ai/behavior/AssignProfessionFromJobSite.java
+++ b/net/minecraft/world/entity/ai/behavior/AssignProfessionFromJobSite.java
@@ -9,31 +9,49 @@
 import net.minecraft.world.entity.npc.Villager;
 import net.minecraft.world.entity.npc.VillagerProfession;
 
+// CraftBukkit start
+import org.bukkit.craftbukkit.v1_20_R2.entity.CraftVillager;
+import org.bukkit.craftbukkit.v1_20_R2.event.CraftEventFactory;
+import org.bukkit.event.entity.VillagerCareerChangeEvent;
+// CraftBukkit end
+
 public class AssignProfessionFromJobSite {
+
+    public AssignProfessionFromJobSite() {}
+
     public static BehaviorControl<Villager> create() {
-        return BehaviorBuilder.create((context) -> {
-            return context.group(context.present(MemoryModuleType.POTENTIAL_JOB_SITE), context.registered(MemoryModuleType.JOB_SITE)).apply(context, (potentialJobSite, jobSite) -> {
-                return (world, entity, time) -> {
-                    GlobalPos globalPos = context.get(potentialJobSite);
-                    if (!globalPos.pos().closerToCenterThan(entity.position(), 2.0D) && !entity.assignProfessionWhenSpawned()) {
+        return BehaviorBuilder.create((behaviorbuilder_b) -> {
+            return behaviorbuilder_b.group(behaviorbuilder_b.present(MemoryModuleType.POTENTIAL_JOB_SITE), behaviorbuilder_b.registered(MemoryModuleType.JOB_SITE)).apply(behaviorbuilder_b, (memoryaccessor, memoryaccessor1) -> {
+                return (worldserver, entityvillager, i) -> {
+                    GlobalPos globalpos = (GlobalPos) behaviorbuilder_b.get(memoryaccessor);
+
+                    if (!globalpos.pos().closerToCenterThan(entityvillager.position(), 2.0D) && !entityvillager.assignProfessionWhenSpawned()) {
                         return false;
                     } else {
-                        potentialJobSite.erase();
-                        jobSite.set(globalPos);
-                        world.broadcastEntityEvent(entity, (byte)14);
-                        if (entity.getVillagerData().getProfession() != VillagerProfession.NONE) {
+                        memoryaccessor.erase();
+                        memoryaccessor1.set(globalpos);
+                        worldserver.broadcastEntityEvent(entityvillager, (byte) 14);
+                        if (entityvillager.getVillagerData().getProfession() != VillagerProfession.NONE) {
                             return true;
                         } else {
-                            MinecraftServer minecraftServer = world.getServer();
-                            Optional.ofNullable(minecraftServer.getLevel(globalPos.dimension())).flatMap((jobSiteWorld) -> {
-                                return jobSiteWorld.getPoiManager().getType(globalPos.pos());
-                            }).flatMap((poiType) -> {
-                                return BuiltInRegistries.VILLAGER_PROFESSION.stream().filter((profession) -> {
-                                    return profession.heldJobSite().test(poiType);
+                            MinecraftServer minecraftserver = worldserver.getServer();
+
+                            Optional.ofNullable(minecraftserver.getLevel(globalpos.dimension())).flatMap((worldserver1) -> {
+                                return worldserver1.getPoiManager().getType(globalpos.pos());
+                            }).flatMap((holder) -> {
+                                return BuiltInRegistries.VILLAGER_PROFESSION.stream().filter((villagerprofession) -> {
+                                    return villagerprofession.heldJobSite().test(holder);
                                 }).findFirst();
-                            }).ifPresent((profession) -> {
-                                entity.setVillagerData(entity.getVillagerData().setProfession(profession));
-                                entity.refreshBrain(world);
+                            }).ifPresent((villagerprofession) -> {
+                                // CraftBukkit start - Fire VillagerCareerChangeEvent where Villager gets employed
+                                VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.CraftProfession.minecraftToBukkit(villagerprofession), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
+                                if (event.isCancelled()) {
+                                    return;
+                                }
+
+                                entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.CraftProfession.bukkitToMinecraft(event.getProfession())));
+                                // CraftBukkit end
+                                entityvillager.refreshBrain(worldserver);
                             });
                             return true;
                         }
