Increases book generation for all loaded books #4

This commit is contained in:
Kristian Knarvik 2022-08-10 00:26:23 +02:00
parent 7c229fb459
commit ce249a93b3

View File

@ -64,7 +64,8 @@ public final class BookLoader {
}
//Make sure the player can pay for the book
if (BooksWithoutBordersConfig.booksHavePrice() && !sender.hasPermission("bookswithoutborders.bypassBookPrice") &&
if (BooksWithoutBordersConfig.booksHavePrice() &&
!sender.hasPermission("bookswithoutborders.bypassBookPrice") &&
(bookDirectory == BookDirectory.PUBLIC || bookDirectory == BookDirectory.PLAYER) &&
EconomyHelper.cannotPayForBookPrinting((Player) sender, numCopies)) {
return null;
@ -98,6 +99,8 @@ public final class BookLoader {
//Set the metadata and amount to the new book
book.setItemMeta(bookMetadata);
//Increase book generation if enabled
BookHelper.increaseGeneration(book);
book.setAmount(numCopies);
return book;