From 6bea5868ad1ff462e20bf5a671fb14aba842f0aa Mon Sep 17 00:00:00 2001 From: Ghost_chu Date: Sat, 3 Feb 2024 01:34:59 +0800 Subject: [PATCH] fix duplicate --- .../mcplugins/barbatosstorybook/BarbatosStoryBook.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/ghostchu/mcplugins/barbatosstorybook/BarbatosStoryBook.java b/src/main/java/com/ghostchu/mcplugins/barbatosstorybook/BarbatosStoryBook.java index a40a07e..d6f5b2d 100644 --- a/src/main/java/com/ghostchu/mcplugins/barbatosstorybook/BarbatosStoryBook.java +++ b/src/main/java/com/ghostchu/mcplugins/barbatosstorybook/BarbatosStoryBook.java @@ -118,6 +118,15 @@ private void handleStoryBook(Inventory inventory, HumanEntity player) { Map map = new LinkedHashMap<>(); for (ItemStack stack : inventory.getStorageContents()) { if (stack == null) continue; + if (stack.getType() == Material.WRITABLE_BOOK) { + player.sendMessage(ChatColor.GRAY + "需要经过 “签名” 变成 “成书” 才可以放进去哦!"); + if (!player.getInventory().addItem(stack.clone()).isEmpty()) { + player.getLocation().getWorld().dropItem(player.getLocation(), stack.clone()); + } + stack.setAmount(0); + stack.setType(Material.AIR); + continue; + } if (stack.getType() != Material.WRITTEN_BOOK) continue; if (!(stack.getItemMeta() instanceof BookMeta bookMeta)) continue; String author = bookMeta.getAuthor();