mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-12 01:41:05 +01:00
SPIGOT-4889: Add PlayerTakeLecternBookEvent
This commit is contained in:
parent
7d29eb5e5a
commit
5c0d3b25e8
1 changed files with 19 additions and 3 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue