Custom Lore Not Work

Discussion in 'Plugin Development' started by ShogunShoul, Jul 25, 2020.

  1. Offline

    ShogunShoul

    MAIN
    Code:
    package eu.miguel.com;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public final class Bloque extends JavaPlugin {
    
        @Override
        public void onEnable() {
        this.getServer().getPluginManager().registerEvents(new MyEvent(), this);
        Bukkit.getConsoleSender().sendMessage (ChatColor.YELLOW+"Plugin Enableds!");
        }
        public void onDisable() {
    }
    }
    MyEvent
    Code:
    package eu.miguel.com;
    
    import java.util.ArrayList;
    import java.util.List;
    
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    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;
    
    
    public class MyEvent implements Listener{     
       @EventHandler
       public void onBlockBreak(BlockBreakEvent event,Integer amount) {
    
           Player player = event.getPlayer();
           if (event.getBlock().getType().equals(Material.WHEAT)) {
               ItemStack itemstack = new ItemStack(Material.SEEDS, 2);
               ItemMeta meta = itemstack.getItemMeta();
               List<String> lore = new ArrayList<String>();
               lore.add("COMUN");
               meta.setLore(lore);
               itemstack.setItemMeta(meta);
               player.getInventory().addItem(itemstack);
           }
       }
    }
        
     
  2. Offline

    Wick

    You can't modify the variables passed through the event method, remove "Integer amount"
     

Share This Page