Class BookTexts

java.lang.Object
net.pottercraft.ollivanders2.book.BookTexts

public final class BookTexts extends Object
Caches and manages the text content for all Ollivanders2 spells and potions.

This class loads spell and potion text once during plugin initialization and maintains a map of all spell/potion enum names to their corresponding book page content. This caching prevents regenerating the same text repeatedly, since many spells and potions can appear in multiple books.

  • Method Details

    • onEnable

      public void onEnable()
      Add all spells and potions when the plugin is enabled.

      This should be called *after* spells are loaded in to O2Spells and potions loaded in to O2Potions or the lists will be empty.

    • getName

      @Nullable public @Nullable String getName(@NotNull @NotNull String magic)
      Retrieves the display name (heading) for a spell or potion by its enum name.
      Parameters:
      magic - the spell or potion enum name (e.g., "EXPELLIARMUS")
      Returns:
      the display name for that spell/potion, or null if not found