diff options
author | EvilSeph <evilseph@gmail.com> | 2012-10-27 20:44:11 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-10-27 20:44:16 -0400 |
commit | df7f86d0282700add2065898c88342ad566a8a8b (patch) | |
tree | a0b202c4838bc57c8bb159d97d8bb6802c91f157 | |
parent | bd6c824c11e38da2cd1cf96f45f0c5068c473db2 (diff) | |
download | craftbukkit-df7f86d0282700add2065898c88342ad566a8a8b.tar craftbukkit-df7f86d0282700add2065898c88342ad566a8a8b.tar.gz craftbukkit-df7f86d0282700add2065898c88342ad566a8a8b.tar.lz craftbukkit-df7f86d0282700add2065898c88342ad566a8a8b.tar.xz craftbukkit-df7f86d0282700add2065898c88342ad566a8a8b.zip |
Made books less powerful, though you should still read them!
-rw-r--r-- | src/main/java/net/minecraft/server/ItemStack.java | 10 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 6 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index efe82d34..cee75b55 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -329,4 +329,14 @@ public final class ItemStack { public boolean hasEnchantments() { return this.tag != null && this.tag.hasKey("ench"); } + + // CraftBukkit start - temporary method for book fix + public void a(String s, NBTBase nbtbase) { + if (this.tag == null) { + this.setTag(new NBTTagCompound()); + } + + this.tag.set(s, nbtbase); + } + // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index d41da15f..6b33ae53 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -1426,7 +1426,11 @@ public class NetServerHandler extends NetHandler { itemstack1 = this.player.inventory.getItemInHand(); if (itemstack != null && itemstack.id == Item.WRITTEN_BOOK.id && itemstack1.id == Item.BOOK_AND_QUILL.id) { - itemstack1.setTag(itemstack.getTag()); + // CraftBukkit start + itemstack1.a("author", new NBTTagString("author", this.player.name)); + itemstack1.a("title", new NBTTagString("title", itemstack.getTag().getString("title"))); + itemstack1.a("pages", itemstack.getTag().getList("pages")); + // CraftBukkit end itemstack1.id = Item.WRITTEN_BOOK.id; } } catch (Exception exception1) { |