Heres my code. import java.util.ArrayList; import java.util.List; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.java.JavaPlugin; public class Mob extends JavaPlugin implements Listener { public void onEnable(){ Bukkit.getServer().getPluginManager().registerEvents(this, this); } List<String> lores = new ArrayList<String>(); @EventHandler public void Luckyblock(BlockBreakEvent e){ ItemStack Luckysword = new ItemStack(Material.DIAMOND_SWORD, 1); String Mydisplayname = ChatColor.GREEN + "Lucky Sword"; Luckysword.addEnchantment(Enchantment.DAMAGE_ALL, 3); lores.add("Lore"); ItemMeta im = Luckysword.getItemMeta(); im.setLore(lores); Luckysword.setItemMeta(im); im.setDisplayName(Mydisplayname); if(e.getBlock().getType() == Material.SPONGE) { e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), Luckysword); } } } Here's my problem. When i break a block of Sponge it will give me another diamond Sword, Having the lore i wanted it to. have everything works but one thing. when i break a block of sponge it will give me another diamond sword saying 'Lore' Twice if i break another it will give me one with Three lores instead of one. and so on and so on. im new to making bukkit plugins please don't hate = [
Why do you have a List<String> lore? Just directly set the lore in the itemstack: Code: ItemMeta meta = item.getItemMeta(); meta.setLore(Arrays.asList("Line 1", "Line 2", "...")); item.setItemMeta(meat);
Just do what FisheyLP says. If you set it directly, you won't have a problem. Alternatively, make it this: Code: List<String> lores = Arrays.asList("Lore");