Fixed /giverandombook with full inventory

This commit is contained in:
Auxilor 2021-04-14 12:23:37 +01:00
parent 56bdd44b50
commit 64ae9f3de2

View File

@ -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");