diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java index d517d7d587..2ed6ad72dc 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java @@ -175,6 +175,10 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { return !pages.isEmpty(); } + public boolean hasGeneration() { + return generation != null; + } + public String getTitle() { return this.title; } @@ -292,6 +296,9 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { if (hasPages()) { hash = 61 * hash + 17 * this.pages.hashCode(); } + if (hasGeneration()) { + hash = 61 * hash + 19 * this.generation.hashCode(); + } return original != hash ? CraftMetaBook.class.hashCode() ^ hash : hash; } @@ -305,7 +312,8 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { return (hasTitle() ? that.hasTitle() && this.title.equals(that.title) : !that.hasTitle()) && (hasAuthor() ? that.hasAuthor() && this.author.equals(that.author) : !that.hasAuthor()) - && (hasPages() ? that.hasPages() && this.pages.equals(that.pages) : !that.hasPages()); + && (hasPages() ? that.hasPages() && this.pages.equals(that.pages) : !that.hasPages()) + && (hasGeneration() ? that.hasGeneration() && this.generation.equals(that.generation) : !that.hasGeneration()); } return true; }