Class BookLoader
java.lang.Object
com.github.darksoulq.abyssallib.server.resource.util.BookLoader
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.inventory.ItemStackload(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.key.Key id) Loads a written book from a resource file located atbooks/<path>.jsoninside the plugin's jar.
-
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 atbooks/<path>.jsoninside the plugin's jar.- Parameters:
plugin- the plugin instance used to access resourcesid- the resource location for the book (used to construct the file path)- Returns:
- a Bukkit
ItemStackrepresenting the written book - Throws:
IllegalStateException- if the resource cannot be foundRuntimeException- if parsing or loading fails
-