13
0
geforkt von Mirrors/Paper

SPIGOT-6557: PlayerEditBookEvent#setNewBookMeta does not update meta

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2021-06-14 19:37:21 +10:00
Ursprung 46c18bc4d5
Commit 46666cb5a8

Datei anzeigen

@ -384,7 +384,7 @@
if (itemstack.a(Items.WRITABLE_BOOK)) { if (itemstack.a(Items.WRITABLE_BOOK)) {
- this.a(list, UnaryOperator.identity(), itemstack); - 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) -> { this.a(list, (s) -> {
return IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) (new ChatComponentText(s))); return IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) (new ChatComponentText(s)));
- }, itemstack1); - }, itemstack1);
- this.player.getInventory().setItem(i, itemstack1);
+ }, itemstack1, i, itemstack); // CraftBukkit + }, 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<ITextFilter.a> list, UnaryOperator<String> unaryoperator, ItemStack itemstack) { - private void a(List<ITextFilter.a> list, UnaryOperator<String> unaryoperator, ItemStack itemstack) {
+ private void a(List<ITextFilter.a> list, UnaryOperator<String> unaryoperator, ItemStack itemstack, int slot, ItemStack old) { // CraftBukkit + private void a(List<ITextFilter.a> list, UnaryOperator<String> unaryoperator, ItemStack itemstack, int slot, ItemStack handItem) { // CraftBukkit
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
if (this.player.R()) { if (this.player.R()) {
@ -412,7 +413,7 @@
} }
itemstack.a("pages", (NBTBase) nbttaglist); itemstack.a("pages", (NBTBase) nbttaglist);
+ CraftEventFactory.handleEditBookEvent(player, slot, old, itemstack); // CraftBukkit + CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack); // CraftBukkit
} }
@Override @Override