summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2015-04-14 10:14:29 +0100
committerThinkofdeath <thinkofdeath@spigotmc.org>2015-04-14 10:14:29 +0100
commit815922ab1a1b3b7c373fba9f9fe56a0ebc909c45 (patch)
tree92d12702f0a4a1da32ed15f6e8397808c8e94623
parenta5b7881dbeedf6ac67c7729e25d3f06c70b27ee9 (diff)
downloadcraftbukkit-815922ab1a1b3b7c373fba9f9fe56a0ebc909c45.tar
craftbukkit-815922ab1a1b3b7c373fba9f9fe56a0ebc909c45.tar.gz
craftbukkit-815922ab1a1b3b7c373fba9f9fe56a0ebc909c45.tar.lz
craftbukkit-815922ab1a1b3b7c373fba9f9fe56a0ebc909c45.tar.xz
craftbukkit-815922ab1a1b3b7c373fba9f9fe56a0ebc909c45.zip
SPIGOT-802: Improve book handling
-rw-r--r--nms-patches/PlayerConnection.patch37
1 files changed, 17 insertions, 20 deletions
diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch
index 472b9e09..5aa853ed 100644
--- a/nms-patches/PlayerConnection.patch
+++ b/nms-patches/PlayerConnection.patch
@@ -1,5 +1,5 @@
---- ../work/decompile-73f3c166/net/minecraft/server/PlayerConnection.java 2015-04-09 10:11:00.935204218 +1000
-+++ src/main/java/net/minecraft/server/PlayerConnection.java 2015-04-09 10:11:00.939204199 +1000
+--- /home/matt/mc-dev-private//net/minecraft/server/PlayerConnection.java 2015-04-14 10:14:05.807811715 +0100
++++ src/main/java/net/minecraft/server/PlayerConnection.java 2015-04-14 10:14:05.811811715 +0100
@@ -17,6 +17,48 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -1390,13 +1390,13 @@
ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b()).iterator();
-@@ -913,13 +1864,15 @@
+@@ -913,13 +1864,16 @@
itemstack1 = this.player.inventory.getItemInHand();
if (itemstack1 != null) {
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
-- itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
-+ // itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
-+ CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit
++ itemstack1 = new ItemStack(Items.WRITABLE_BOOK); // CraftBukkit
+ itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
++ CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit
}
return;
@@ -1407,20 +1407,17 @@
return;
} finally {
packetdataserializer.release();
-@@ -942,16 +1895,20 @@
+@@ -942,16 +1896,21 @@
itemstack1 = this.player.inventory.getItemInHand();
if (itemstack1 != null) {
if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) {
-- itemstack1.a("author", (NBTBase) (new NBTTagString(this.player.getName())));
-- itemstack1.a("title", (NBTBase) (new NBTTagString(itemstack.getTag().getString("title"))));
-- itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
-- itemstack1.setItem(Items.WRITTEN_BOOK);
+ // CraftBukkit start
-+ // itemstack1.a("author", (NBTBase) (new NBTTagString(this.player.getName())));
-+ // itemstack1.a("title", (NBTBase) (new NBTTagString(itemstack.getTag().getString("title"))));
-+ // itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
-+ // itemstack1.setItem(Items.WRITTEN_BOOK);
-+ CraftEventFactory.handleEditBookEvent(player, itemstack);
++ itemstack1 = new ItemStack(Items.WRITTEN_BOOK);
+ itemstack1.a("author", (NBTBase) (new NBTTagString(this.player.getName())));
+ itemstack1.a("title", (NBTBase) (new NBTTagString(itemstack.getTag().getString("title"))));
+ itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
+ itemstack1.setItem(Items.WRITTEN_BOOK);
++ CraftEventFactory.handleEditBookEvent(player, itemstack1);
+ // CraftBukkit end
}
@@ -1432,7 +1429,7 @@
return;
} finally {
packetdataserializer.release();
-@@ -968,11 +1925,12 @@
+@@ -968,11 +1927,12 @@
}
} catch (Exception exception2) {
PlayerConnection.c.error("Couldn\'t select trade", exception2);
@@ -1446,7 +1443,7 @@
packetdataserializer = packetplayincustompayload.b();
try {
-@@ -1008,6 +1966,7 @@
+@@ -1008,6 +1968,7 @@
}
} catch (Exception exception3) {
PlayerConnection.c.error("Couldn\'t set command block", exception3);
@@ -1454,7 +1451,7 @@
} finally {
packetdataserializer.release();
}
-@@ -1033,6 +1992,7 @@
+@@ -1033,6 +1994,7 @@
}
} catch (Exception exception4) {
PlayerConnection.c.error("Couldn\'t set beacon", exception4);
@@ -1462,7 +1459,7 @@
}
}
} else if ("MC|ItemName".equals(packetplayincustompayload.a()) && this.player.activeContainer instanceof ContainerAnvil) {
-@@ -1048,7 +2008,28 @@
+@@ -1048,7 +2010,28 @@
containeranvil.a("");
}
}