SPIGOT-6411: The PlayerEditBookEvent is not called when the player edits a book in the off-hand.
This commit is contained in:
parent
be0e945812
commit
721c4966be
@ -1273,7 +1273,7 @@ public class CraftEventFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack handleEditBookEvent(EntityPlayer player, int itemInHandIndex, ItemStack itemInHand, ItemStack newBookItem) {
|
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);
|
player.world.getServer().getPluginManager().callEvent(editBookEvent);
|
||||||
|
|
||||||
// If they've got the same item in their hand, it'll need to be updated.
|
// If they've got the same item in their hand, it'll need to be updated.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user