From 46666cb5a8c350b3b53eb69e36b448a942cb3a36 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 14 Jun 2021 19:37:21 +1000 Subject: [PATCH] SPIGOT-6557: PlayerEditBookEvent#setNewBookMeta does not update meta By: md_5 --- .../net/minecraft/server/network/PlayerConnection.patch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch b/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch index 367b78af52..8109d78109 100644 --- a/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch +++ b/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch @@ -384,7 +384,7 @@ if (itemstack.a(Items.WRITABLE_BOOK)) { - this.a(list, UnaryOperator.identity(), itemstack); -+ this.a(list, UnaryOperator.identity(), itemstack, i, itemstack.cloneItemStack()); // CraftBukkit ++ this.a(list, UnaryOperator.identity(), itemstack.cloneItemStack(), i, itemstack); // CraftBukkit } } @@ -393,13 +393,14 @@ this.a(list, (s) -> { return IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) (new ChatComponentText(s))); - }, itemstack1); +- this.player.getInventory().setItem(i, itemstack1); + }, itemstack1, i, itemstack); // CraftBukkit - this.player.getInventory().setItem(i, itemstack1); ++ this.player.getInventory().setItem(i, itemstack); // CraftBukkit - event factory updates the hand book } } - private void a(List list, UnaryOperator unaryoperator, ItemStack itemstack) { -+ private void a(List list, UnaryOperator unaryoperator, ItemStack itemstack, int slot, ItemStack old) { // CraftBukkit ++ private void a(List list, UnaryOperator unaryoperator, ItemStack itemstack, int slot, ItemStack handItem) { // CraftBukkit NBTTagList nbttaglist = new NBTTagList(); if (this.player.R()) { @@ -412,7 +413,7 @@ } itemstack.a("pages", (NBTBase) nbttaglist); -+ CraftEventFactory.handleEditBookEvent(player, slot, old, itemstack); // CraftBukkit ++ CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack); // CraftBukkit } @Override