I am kinda stuck with making a plugin... This is my code I have:
Player player = (Player)event.getPlayer();
ItemStack item = new ItemStack( /* player.getInventory() */ /* My problem here is how do i drop all items that or in my inventory (Some items might have enchantments!) */);
World world = player.getWorld();
world.dropItem(player.getLocation(), item);
Does someone know how I drop all items that are in my inventory? Some items could have enchantments and cannot be removed while dropping.
What about iterating over the players inventory and using dropItemNaturally?
for (ItemStack itemStack : player.getInventory()) {
player.getWorld().dropItemNaturally(player.getLocation(), itemStack);
}