Rewrite book handling, Fixes SPIGOT-182 and part of SPIGOT-164

By: Thinkofdeath <thinkofdeath@spigotmc.org>
This commit is contained in:
CraftBukkit/Spigot
2014-12-11 19:38:09 +00:00
parent 102d551006
commit 7d1aaec723
7 changed files with 190 additions and 72 deletions

View File

@@ -826,10 +826,10 @@ public class CraftEventFactory {
// If they've got the same item in their hand, it'll need to be updated.
if (itemInHand != null && itemInHand.getItem() == Items.WRITABLE_BOOK) {
if (!editBookEvent.isCancelled()) {
CraftItemStack.setItemMeta(itemInHand, editBookEvent.getNewBookMeta());
if (editBookEvent.isSigning()) {
itemInHand.setItem(Items.WRITTEN_BOOK);
}
CraftItemStack.setItemMeta(itemInHand, editBookEvent.getNewBookMeta());
}
// Client will have updated its idea of the book item; we need to overwrite that