Class BookLoader

java.lang.Object
com.github.darksoulq.abyssallib.server.resource.util.BookLoader

public class BookLoader extends Object
Utility class for loading written books from JSON files within a plugin's resources.

JSON structure example:

{
  "title": "Example Book",
  "author": "John Doe",
  "pages": [
    ["<bold>Hello</bold>", "This is a test."],
    ["Another page."]
  ]
}
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.inventory.ItemStack
    load(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.key.Key id)
    Loads a written book from a resource file located at books/<path>.json inside the plugin's jar.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BookLoader

      public BookLoader()
  • Method Details

    • load

      public static org.bukkit.inventory.ItemStack load(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.key.Key id)
      Loads a written book from a resource file located at books/<path>.json inside the plugin's jar.
      Parameters:
      plugin - the plugin instance used to access resources
      id - the resource location for the book (used to construct the file path)
      Returns:
      a Bukkit ItemStack representing the written book
      Throws:
      IllegalStateException - if the resource cannot be found
      RuntimeException - if parsing or loading fails