From ab13683d8e636bf10f2fe7702b01c33e4737bba1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 8 Jul 2018 10:25:17 +1000 Subject: SPIGOT-3987: Preserve attributes when writing in books --- nms-patches/PlayerConnection.patch | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 06ad6f64..e67b4538 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -1593,11 +1593,9 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1064,15 +2166,25 @@ - } +@@ -1065,14 +2167,23 @@ if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { -+ itemstack1 = new ItemStack(Items.WRITABLE_BOOK); // CraftBukkit itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8)); + CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit } @@ -1619,7 +1617,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1106,10 +2218,11 @@ +@@ -1106,10 +2217,11 @@ } itemstack2.a("pages", (NBTBase) nbttaglist); @@ -1632,7 +1630,7 @@ } } else if ("MC|TrSel".equals(s)) { try { -@@ -1121,6 +2234,7 @@ +@@ -1121,6 +2233,7 @@ } } catch (Exception exception2) { PlayerConnection.LOGGER.error("Couldn\'t select trade", exception2); @@ -1640,7 +1638,7 @@ } } else { TileEntity tileentity; -@@ -1170,6 +2284,7 @@ +@@ -1170,6 +2283,7 @@ } } catch (Exception exception3) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception3); @@ -1648,7 +1646,7 @@ } } else if ("MC|AutoCmd".equals(s)) { if (!this.minecraftServer.getEnableCommandBlock()) { -@@ -1237,6 +2352,7 @@ +@@ -1237,6 +2351,7 @@ } } catch (Exception exception4) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception4); @@ -1656,7 +1654,7 @@ } } else { int k; -@@ -1260,6 +2376,7 @@ +@@ -1260,6 +2375,7 @@ } } catch (Exception exception5) { PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5); @@ -1664,7 +1662,7 @@ } } } else if ("MC|ItemName".equals(s)) { -@@ -1346,6 +2463,7 @@ +@@ -1346,6 +2462,7 @@ } } catch (Exception exception6) { PlayerConnection.LOGGER.error("Couldn\'t set structure block", exception6); @@ -1672,7 +1670,7 @@ } } else if ("MC|PickItem".equals(s)) { packetdataserializer = packetplayincustompayload.b(); -@@ -1358,11 +2476,49 @@ +@@ -1358,11 +2475,49 @@ this.player.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex)); } catch (Exception exception7) { PlayerConnection.LOGGER.error("Couldn\'t pick item", exception7); -- cgit v1.2.3