mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
25 lines
1.4 KiB
Diff
25 lines
1.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
Date: Sun, 27 Dec 2020 11:31:06 +0000
|
|
Subject: [PATCH] Fix crash from invalid ingredient lists in
|
|
VillagerAcquireTradeEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
|
index ddc002f269527201724457c0b820788200441e0c..9bc5a9592cabe087effc03e5347ea1d75794960b 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
|
@@ -261,7 +261,11 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
|
|
Bukkit.getPluginManager().callEvent(event);
|
|
}
|
|
if (!event.isCancelled()) {
|
|
- recipeList.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
|
|
+ // Paper start - Fix crash from invalid ingredient list
|
|
+ final CraftMerchantRecipe craftMerchantRecipe = CraftMerchantRecipe.fromBukkit(event.getRecipe());
|
|
+ if (craftMerchantRecipe.getIngredients().isEmpty()) return;
|
|
+ recipeList.add(craftMerchantRecipe.toMinecraft());
|
|
+ // Paper end - Fix crash from invalid ingredient list
|
|
}
|
|
// CraftBukkit end
|
|
++j;
|