From 64ae9f3de2b6327e0d5fe931cc75dc41d2f8a9ca Mon Sep 17 00:00:00 2001 From: Auxilor Date: Wed, 14 Apr 2021 12:23:37 +0100 Subject: [PATCH] Fixed /giverandombook with full inventory --- .../ecoenchants/command/commands/CommandGiverandombook.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandGiverandombook.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandGiverandombook.java index 048ef424..e982eb93 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandGiverandombook.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandGiverandombook.java @@ -53,7 +53,9 @@ public class CommandGiverandombook extends AbstractCommand { meta.addStoredEnchant(enchantment, level, true); itemStack.setItemMeta(meta); - player.getInventory().addItem(itemStack); + for (ItemStack stack : player.getInventory().addItem(itemStack).values()) { + player.getWorld().dropItem(player.getLocation(), stack); + } String message = this.getPlugin().getLangYml().getMessage("gave-random-book"); message = message.replace("%enchantment%", EnchantmentCache.getEntry(enchantment).getName() + " " + NumberUtils.toNumeral(level) + "§r");