mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 02:55:47 +01:00
70ad51a80c
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
My recent work on serialization is now in CraftBukkit so was able to drop the patch and Paper
is now consistent with upstream.
Bukkit Changes:
e2699636 Move API notes to more obvious location
CraftBukkit Changes:
1b2830a3
SPIGOT-4441: Fix serializing Components to and from Legacy
31 lines
1.9 KiB
Diff
31 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Michael Himing <mhiming@gmail.com>
|
|
Date: Sun, 16 Dec 2018 13:07:33 +1100
|
|
Subject: [PATCH] Fix PlayerEditBookEvent
|
|
|
|
- Updating book writing (not signing) mutated the original item, making
|
|
it impossible to properly cancel the event or modify the book meta
|
|
|
|
- When the event was cancelled, the client's book would keep the
|
|
cancelled writing
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
index 52a6738bdbffb3344717709281ac09da84e7a525..81d40e1dbc6c03033612e04a20cd18e0aa304d2e 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -871,9 +871,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
itemstack2.a("pages", (NBTBase) nbttaglist);
|
|
this.player.a(packetplayinbedit.d(), CraftEventFactory.handleEditBookEvent(player, enumitemslot, itemstack1, itemstack2)); // CraftBukkit
|
|
} else {
|
|
- ItemStack old = itemstack1.cloneItemStack(); // CraftBukkit
|
|
- itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
|
|
- CraftEventFactory.handleEditBookEvent(player, enumitemslot, old, itemstack1); // CraftBukkit
|
|
+ // Paper start - dont mutate players current item, set it from the event
|
|
+ ItemStack newBook = itemstack1.cloneItemStack();
|
|
+ newBook.getOrCreateTagAndSet("pages", (NBTBase)itemstack.getTag().getList("pages", 8));
|
|
+ this.player.setSlot(enumitemslot, CraftEventFactory.handleEditBookEvent(player, enumitemslot, itemstack1, newBook));
|
|
+ // Paper end
|
|
}
|
|
}
|
|
|