Merge fixes
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good

This commit is contained in:
2025-08-10 19:21:14 +02:00
parent e43649fef4
commit f08d378295
3 changed files with 21 additions and 5 deletions

View File

@@ -258,8 +258,8 @@ public class BooksWithoutBorders extends JavaPlugin {
registerCommand(BwBCommand.SET_BOOK_GENERATION.toString(), new CommandSetGeneration());
registerCommand(BwBCommand.CLEAR_BOOK.toString(), new CommandClear());
registerCommand(BwBCommand.SET_BOOKSHELF_DATA.toString(), new CommandSetBookshelfData());
registerCommand("addBookTitlePage", new CommandAddTitlePage());
registerCommand("deleteBookPage", new CommandDeletePage());
registerCommand(BwBCommand.ADD_TITLE_PAGE.toString(), new CommandAddTitlePage());
registerCommand(BwBCommand.DELETE_PAGE.toString(), new CommandDeletePage());
}
/**

View File

@@ -1,7 +1,6 @@
package net.knarcraft.bookswithoutborders.command;
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
import net.knarcraft.bookswithoutborders.config.BooksWithoutBordersConfig;
import net.knarcraft.bookswithoutborders.utility.BookFormatter;
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
import net.md_5.bungee.api.ChatColor;
@@ -79,7 +78,7 @@ public class CommandAddTitlePage implements TabExecutor {
}
if (title == null && heldBook.getType() == Material.WRITTEN_BOOK) {
String loreSeparator = BooksWithoutBordersConfig.getLoreSeparator();
String loreSeparator = BooksWithoutBorders.getConfiguration().getLoreSeparator();
if (index > pages.size()) {
pages.add(formatTitle(bookMeta.getTitle() + loreSeparator + "By: " + bookMeta.getAuthor()));
} else {
@@ -111,7 +110,7 @@ public class CommandAddTitlePage implements TabExecutor {
* @return <p>The formatted input</p>
*/
private String formatTitle(@NotNull String input) {
String loreSeparator = BooksWithoutBordersConfig.getLoreSeparator();
String loreSeparator = BooksWithoutBorders.getConfiguration().getLoreSeparator();
if (input.contains(loreSeparator)) {
String[] parts = input.split(loreSeparator);
StringBuilder output = new StringBuilder("\n");

View File

@@ -121,6 +121,23 @@ public enum BwBCommand {
* Un-signs the held signed book
*/
UNSIGN_BOOK("unsignBook", true),
/**
* Adds a title page, blank page or chapter page to the held book
*
* <p>If no input is given, and a signed book is provided, a title page will be added to the beginning of the book.
* If an index is given, and a signed book is provided, a title page will be added to the specified index.
* If no input is given, and an unsigned book is provided, an error will be displayed.
* If an index is given, but no text, and a signed book is provided, a blank page is added to the specified index.
* If both an index and text is given, and a signed or unsigned book is provided, a custom chapter page depending on
* the text will be added to the specified index.</p>
*/
ADD_TITLE_PAGE("addBookTitlePage", true),
/**
* Deletes a page from the held book
*/
DELETE_PAGE("deleteBookPage", true),
;
private final @NotNull String commandName;