2019-04-23 04:00:00 +02:00
|
|
|
--- a/net/minecraft/server/EntityVillagerTrader.java
|
|
|
|
+++ b/net/minecraft/server/EntityVillagerTrader.java
|
|
|
|
@@ -2,6 +2,12 @@
|
|
|
|
|
|
|
|
import java.util.EnumSet;
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.Bukkit;
|
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe;
|
|
|
|
+import org.bukkit.entity.AbstractVillager;
|
|
|
|
+import org.bukkit.event.entity.VillagerAcquireTradeEvent;
|
|
|
|
+// CraftBukkit end
|
|
|
|
|
|
|
|
public class EntityVillagerTrader extends EntityVillagerAbstract {
|
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
@@ -89,7 +95,16 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.a(this, this.random);
|
|
|
|
|
|
|
|
if (merchantrecipe != null) {
|
|
|
|
- merchantrecipelist.add(merchantrecipe);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ VillagerAcquireTradeEvent event = new VillagerAcquireTradeEvent((AbstractVillager) getBukkitEntity(), merchantrecipe.asBukkit());
|
|
|
|
+ // Suppress during worldgen
|
|
|
|
+ if (this.valid) {
|
|
|
|
+ Bukkit.getPluginManager().callEvent(event);
|
|
|
|
+ }
|
|
|
|
+ if (!event.isCancelled()) {
|
|
|
|
+ merchantrecipelist.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|