Class O2Book

java.lang.Object
net.pottercraft.ollivanders2.book.O2Book
Direct Known Subclasses:
A_BEGINNERS_GUIDE_TO_TRANSFIGURATION, ACHIEVEMENTS_IN_CHARMING, ADVANCED_FIREWORKS, ADVANCED_POTION_MAKING, ADVANCED_TRANSFIGURATION, BASIC_FIREWORKS, BASIC_HEXES, BOOK_OF_POTIONS, BREAK_WITH_A_BANSHEE, CHADWICKS_CHARMS_VOLUME_1, CHARMING_COLORS, CONFRONTING_THE_FACELESS, CURSES_AND_COUNTERCURSES, DE_MEDICINA_PRAECEPTA, DEFENSE_AGAINST_THE_DARK_ARTS, ESSENTIAL_DARK_ARTS, EXTREME_INCANTATIONS, FANTASTIC_BEASTS, FOR_THE_GREATER_GOOD, GADDING_WITH_GHOULS, HARMONIOUS_CONNECTIONS, HOLIDAYS_WITH_HAGS, INTERMEDIATE_TRANSFIGURATION, JINXES_FOR_THE_JINXED, MAGICAL_DRAFTS_AND_POTIONS, MAGICK_MOSTE_EVILE, MODERN_MAGICAL_TRANSPORTATION, MOSTE_POTENTE_POTIONS, NUMEROLOGY_AND_GRAMMATICA, OMENS_ORACLES_AND_THE_GOAT, POTION_OPUSCULE, PRACTICAL_DEFENSIVE_MAGIC, QUINTESSENCE_A_QUEST, SECRETS_OF_THE_DARKEST_ART, SECRETS_OF_WANDLORE, STANDARD_BOOK_OF_SPELLS_GRADE_1, STANDARD_BOOK_OF_SPELLS_GRADE_2, STANDARD_BOOK_OF_SPELLS_GRADE_3, STANDARD_BOOK_OF_SPELLS_GRADE_4, STANDARD_BOOK_OF_SPELLS_GRADE_5, STANDARD_BOOK_OF_SPELLS_GRADE_6, STANDARD_BOOK_OF_SPELLS_GRADE_7, TETRABIBLIOS, THE_DARK_FORCES, THE_HEALERS_HELPMATE, TRAVELS_WITH_TROLLS, UNFOGGING_THE_FUTURE, VOYAGES_WITH_VAMPIRES, WANDERINGS_WITH_WEREWOLVES, YEAR_WITH_A_YETI

public abstract class O2Book extends Object
Super class for all Ollivanders2 books.

Book limits:

  • Title - 32 characters
  • Pages - 50
  • Lines per page - 14
  • Characters per page - 256 (newlines count as 2 characters)
  • Characters per line - 16-18 depending on the exact characters
  • Field Details

    • bookType

      protected O2BookType bookType
      The type of book defining its author, title, and magic branch
    • o2BookTypeKey

      public static org.bukkit.NamespacedKey o2BookTypeKey
      Namespace key for NBT tag - book type
    • o2BookSpellsKey

      public static org.bukkit.NamespacedKey o2BookSpellsKey
      Namespace key for NBT tag - spells
    • o2BookPotionsKey

      public static org.bukkit.NamespacedKey o2BookPotionsKey
      Namespace key for NBT tag - potions
    • p

      protected Ollivanders2 p
      Callback to the plugin
    • spells

      protected ArrayList<O2SpellType> spells
      Spells in book
    • potions

      protected ArrayList<O2PotionType> potions
      Potions in book
  • Constructor Details

    • O2Book

      public O2Book(@NotNull @NotNull Ollivanders2 plugin)
      Constructor that initializes a new book instance.

      Initializes the book type to STANDARD_BOOK_OF_SPELLS_GRADE_1, empty opening and closing pages, empty spell and potion lists, and creates the required NamespacedKeys for NBT data storage. The actual book item is created lazily on the first call to getBookItem().

      Parameters:
      plugin - a callback to the Ollivanders2 plugin instance
  • Method Details

    • getBookItem

      @NotNull public @NotNull org.bukkit.inventory.ItemStack getBookItem()
      Get the book item for this book
      Returns:
      the book item
    • getTitle

      @NotNull public @NotNull String getTitle()
      Get the title for this book.
      Returns:
      title
    • getShortTitle

      @NotNull public @NotNull String getShortTitle()
      Get the short title for this book
      Returns:
      short title for this book
    • getAuthor

      @NotNull public @NotNull String getAuthor()
      The author for this book.
      Returns:
      author
    • getBranch

      @NotNull public @NotNull O2MagicBranch getBranch()
      The branch for this book.
      Returns:
      branch
    • getNumberOfSpells

      public int getNumberOfSpells()
      Get the number of spells in this book.
      Returns:
      number of spells
    • getNumberOfPotions

      public int getNumberOfPotions()
      Get the number of potions in this book.
      Returns:
      number of potions