Skip to content

Commit

Permalink
fix duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Feb 2, 2024
1 parent e914351 commit 6bea586
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ private void handleStoryBook(Inventory inventory, HumanEntity player) {
Map<ItemStack, StoryBook> 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();
Expand Down

0 comments on commit 6bea586

Please sign in to comment.