diff --git a/src/main/java/net/knarcraft/bookswithoutborders/BooksWithoutBorders.java b/src/main/java/net/knarcraft/bookswithoutborders/BooksWithoutBorders.java index 4a75299..4a0e6ea 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/BooksWithoutBorders.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/BooksWithoutBorders.java @@ -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()); } /** diff --git a/src/main/java/net/knarcraft/bookswithoutborders/command/CommandAddTitlePage.java b/src/main/java/net/knarcraft/bookswithoutborders/command/CommandAddTitlePage.java index 7774ed8..adfa196 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/command/CommandAddTitlePage.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/command/CommandAddTitlePage.java @@ -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
The formatted input
*/ 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"); diff --git a/src/main/java/net/knarcraft/bookswithoutborders/config/BwBCommand.java b/src/main/java/net/knarcraft/bookswithoutborders/config/BwBCommand.java index 2a4610c..541c513 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/config/BwBCommand.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/config/BwBCommand.java @@ -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 + * + *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.
+ */ + ADD_TITLE_PAGE("addBookTitlePage", true), + + /** + * Deletes a page from the held book + */ + DELETE_PAGE("deleteBookPage", true), ; private final @NotNull String commandName;