MiniBook API 🛠️
📄 Introduction
The MiniBookAPI provides static methods to interact programmatically with MiniBook. You can create, manage, and delete books, open books for players, and customize titles, authors, permissions, and pages directly from your code without instantiating the API.
🛠 Installation
Add the repository and dependency for MiniBook.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.xDrygo</groupId>
<artifactId>MiniBook</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>After adding the dependency, add MiniBook as a dependency in your plugin.
name: MyPlugin
main: com.example.MyPlugin.MyPlugin
version: 1.0
depend: # depend if API is required, soft-depend if optional
- MiniBook📋 MiniBookAPI Methods
Click to expand
Opens a book for a player.boolean openBook(String bookId, Player player)
boolean opened = MiniBookAPI.openBook("tutorial", player);
if (opened) {
player.sendMessage("Book opened successfully!");
}
Creates a new book and saves it to the configuration files.boolean createBook(String bookId, String title, String author, Boolean premium, String permission, String... pages)
boolean created = MiniBookAPI.createBook(
"welcome",
"Welcome Guide",
"Server Admin",
false,
"minibook.welcome",
"<gradient:#ff0000:#00ff00>Welcome to our server!</gradient>",
"<bold>Rules:</bold>\n<gray>1. Be respectful\n2. No griefing</gray>"
);
Deletes an existing book.boolean deleteBook(String bookId)
boolean deleted = MiniBookAPI.deleteBook("oldGuide");
if (deleted) {
System.out.println("Book deleted successfully!");
}
Retrieves all loaded books as complete objects (BookData).List<BookData> getBooks()
List<BookData> allBooks = MiniBookAPI.getBooks();
for (BookData book : allBooks) {
System.out.println("Book: " + book.getTitle());
}
Retrieves the IDs of all loaded books.List<String> getBookIds()
List<String> ids = MiniBookAPI.getBookIds();
ids.forEach(id -> System.out.println("ID: " + id));
Retrieves the data of a specific book.BookData getBook(String bookId)
BookData book = MiniBookAPI.getBook("tutorial");
if (book != null) {
System.out.println("Title: " + book.getTitle());
System.out.println("Author: " + book.getAuthor());
}
Retrieves the ItemStack of a specific book.ItemStack getBookItem(String bookId)
ItemStack bookItem = MiniBookAPI.getBookItem("welcome");
if (bookItem != null) {
player.getInventory().addItem(bookItem);
}
Checks if a book exists.boolean bookExists(String bookId)
if (MiniBookAPI.bookExists("tutorial")) {
System.out.println("The tutorial book exists!");
}💡 Notes
- All API methods are static, so you do not need to instantiate
MiniBookAPI. - Book management includes creation, deletion, and retrieval of books.
- Books support MiniMessage formatting for rich text and colors.
- The
premiumparameter can benull(defaults tofalse). - The
permissionparameter can benull(auto-generates a permission).