diff --git a/nms-patches/ContainerLectern.patch b/nms-patches/ContainerLectern.patch index 50a32d3724..19aab42ccc 100644 --- a/nms-patches/ContainerLectern.patch +++ b/nms-patches/ContainerLectern.patch @@ -1,12 +1,14 @@ --- a/net/minecraft/server/ContainerLectern.java +++ b/net/minecraft/server/ContainerLectern.java -@@ -1,15 +1,38 @@ +@@ -1,15 +1,40 @@ package net.minecraft.server; +// CraftBukkit start ++import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.inventory.CraftInventoryLectern; +import org.bukkit.craftbukkit.inventory.CraftInventoryView; +import org.bukkit.entity.Player; ++import org.bukkit.event.player.PlayerTakeLecternBookEvent; +// CraftBukkit end + public class ContainerLectern extends Container { @@ -42,7 +44,7 @@ super(Containers.LECTERN, i); a(iinventory, 1); a(icontainerproperties, 1); -@@ -23,6 +46,7 @@ +@@ -23,6 +48,7 @@ } }); this.a(icontainerproperties); @@ -50,7 +52,21 @@ } @Override -@@ -70,6 +94,7 @@ +@@ -48,6 +74,13 @@ + return false; + } + ++ // CraftBukkit start - Event for taking the book ++ PlayerTakeLecternBookEvent event = new PlayerTakeLecternBookEvent(player, ((CraftInventoryLectern) getBukkitView().getTopInventory()).getHolder()); ++ Bukkit.getServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ return false; ++ } ++ // CraftBukkit end + ItemStack itemstack = this.inventory.splitWithoutUpdate(0); + + this.inventory.update(); +@@ -70,6 +103,7 @@ @Override public boolean canUse(EntityHuman entityhuman) {