mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-13 11:02:06 +01:00
SPIGOT-6411: The PlayerEditBookEvent is not called when the player edits a book in the off-hand.
By: md_5 <git@md-5.net>
This commit is contained in:
parent
97cd7810a3
commit
834f035a21
@ -1273,7 +1273,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static ItemStack handleEditBookEvent(EntityPlayer player, int itemInHandIndex, ItemStack itemInHand, ItemStack newBookItem) {
|
||||
PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), itemInHandIndex, (BookMeta) CraftItemStack.getItemMeta(itemInHand), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.getItem() == Items.WRITTEN_BOOK);
|
||||
PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), (itemInHandIndex >= 0 && itemInHandIndex <= 8) ? itemInHandIndex : -1, (BookMeta) CraftItemStack.getItemMeta(itemInHand), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.getItem() == Items.WRITTEN_BOOK);
|
||||
player.world.getServer().getPluginManager().callEvent(editBookEvent);
|
||||
|
||||
// If they've got the same item in their hand, it'll need to be updated.
|
||||
|
Loading…
Reference in New Issue
Block a user