diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java | 8 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java | 28 |
2 files changed, 3 insertions, 33 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java index 441632bb..0b5078e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java @@ -52,10 +52,6 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { } CraftMetaBook(NBTTagCompound tag) { - this(tag, true); - } - - CraftMetaBook(NBTTagCompound tag, boolean handlePages) { super(tag); if (tag.hasKey(BOOK_TITLE.NBT)) { @@ -75,10 +71,10 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { generation = tag.getInt(GENERATION.NBT); } - if (tag.hasKey(BOOK_PAGES.NBT) && handlePages) { + if (tag.hasKey(BOOK_PAGES.NBT)) { NBTTagList pages = tag.getList(BOOK_PAGES.NBT, CraftMagicNumbers.NBT.TAG_STRING); - for (int i = 0; i < pages.size(); i++) { + for (int i = 0; i < Math.min(pages.size(), MAX_PAGES); i++) { String page = pages.getString(i); if (resolved) { try { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java index 05c13d30..ef8bedd6 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java @@ -1,7 +1,5 @@ package org.bukkit.craftbukkit.inventory; -import java.util.ArrayList; -import java.util.List; import java.util.Map; import net.minecraft.server.NBTTagCompound; @@ -10,14 +8,12 @@ import net.minecraft.server.NBTTagList; import org.bukkit.Material; import org.bukkit.configuration.serialization.DelegateDeserialization; import org.bukkit.craftbukkit.inventory.CraftMetaItem.SerializableMeta; -import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.inventory.meta.BookMeta; import com.google.common.collect.ImmutableMap.Builder; import net.minecraft.server.IChatBaseComponent.ChatSerializer; import net.minecraft.server.IChatBaseComponent; import net.minecraft.server.NBTTagString; -import org.bukkit.craftbukkit.util.CraftChatMessage; @DelegateDeserialization(SerializableMeta.class) class CraftMetaBookSigned extends CraftMetaBook implements BookMeta { @@ -27,29 +23,7 @@ class CraftMetaBookSigned extends CraftMetaBook implements BookMeta { } CraftMetaBookSigned(NBTTagCompound tag) { - super(tag, false); - - boolean resolved = true; - if (tag.hasKey(RESOLVED.NBT)) { - resolved = tag.getBoolean(RESOLVED.NBT); - } - - if (tag.hasKey(BOOK_PAGES.NBT)) { - NBTTagList pages = tag.getList(BOOK_PAGES.NBT, CraftMagicNumbers.NBT.TAG_STRING); - - for (int i = 0; i < pages.size(); i++) { - String page = pages.getString(i); - if (resolved) { - try { - this.pages.add(ChatSerializer.a(page)); - continue; - } catch (Exception e) { - // Ignore and treat as an old book - } - } - addPage(page); - } - } + super(tag); } CraftMetaBookSigned(Map<String, Object> map) { |