Tries to fix #9

Sets the amount of books to the same amount as the old book
This commit is contained in:
Kristian Knarvik 2022-11-04 03:05:30 +01:00
parent e893684dec
commit 28b7849ff5

View File

@ -50,6 +50,7 @@ public class CommandUnSign implements TabExecutor {
public void unSignHeldBook(Player player, boolean mainHand) { public void unSignHeldBook(Player player, boolean mainHand) {
//Get the old book //Get the old book
BookMeta oldBook = InventoryHelper.getHeldBookMetadata(player, mainHand); BookMeta oldBook = InventoryHelper.getHeldBookMetadata(player, mainHand);
ItemStack heldBook = InventoryHelper.getHeldBook(player, mainHand);
//Only allow the owner to un-sign the book //Only allow the owner to un-sign the book
if (BooksWithoutBordersConfig.getAuthorOnlyUnsign() && !player.hasPermission("bookswithoutborders.bypassAuthorOnlyUnsign")) { if (BooksWithoutBordersConfig.getAuthorOnlyUnsign() && !player.hasPermission("bookswithoutborders.bypassAuthorOnlyUnsign")) {
@ -60,6 +61,7 @@ public class CommandUnSign implements TabExecutor {
//UnSign the book //UnSign the book
ItemStack newBook = new ItemStack(Material.WRITABLE_BOOK); ItemStack newBook = new ItemStack(Material.WRITABLE_BOOK);
newBook.setAmount(heldBook.getAmount());
newBook.setItemMeta(oldBook); newBook.setItemMeta(oldBook);
InventoryHelper.replaceHeldItem(player, newBook, mainHand); InventoryHelper.replaceHeldItem(player, newBook, mainHand);