2019-05-26 03:58:11 +02:00
|
|
|
--- a/net/minecraft/server/BehaviorProfession.java
|
|
|
|
+++ b/net/minecraft/server/BehaviorProfession.java
|
|
|
|
@@ -1,6 +1,11 @@
|
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
import com.google.common.collect.ImmutableMap;
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.entity.CraftVillager;
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+import org.bukkit.event.entity.VillagerCareerChangeEvent;
|
|
|
|
+// CraftBukkit end
|
|
|
|
|
|
|
|
public class BehaviorProfession extends Behavior<EntityVillager> {
|
|
|
|
|
|
|
|
@@ -15,7 +20,14 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
|
|
|
- entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(VillagerProfession.NONE));
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
|
|
|
+ // CraftBukkit end
|
2020-08-11 23:00:00 +02:00
|
|
|
entityvillager.c(worldserver);
|
2019-05-26 03:58:11 +02:00
|
|
|
}
|
|
|
|
}
|