plugin bug?

Discussion in 'Spigot Plugin Help' started by szymek1223, Jul 12, 2021.

  1. hey, why even if I have a stack of each item (diamond, iron and chest block), it shows me that I cannot create an item (else) and when I have an equal amount of these materials, it shows that I can create an item? how to fix it?
    package pl.items;
    import java.util.ArrayList;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    public class workbench {
    public static ItemStack getItem(Player p) {
    ItemStack db = new ItemStack(Material.CRAFTING_TABLE);
    ItemMeta dbM = db.getItemMeta();

    dbM.setDisplayName("§7Kliknij aby scraftowac §5§lPANDORE");

    ArrayList<String> lore = new ArrayList<String>();

    if(p.getInventory().contains(new ItemStack(Material.IRON_BLOCK, 4)));
    if(p.getInventory().contains(new ItemStack(Material.DIAMOND_BLOCK, 4)));
    if(p.getInventory().contains(new ItemStack(Material.CHEST, 1))) {
    lore.add("§fMozliwosc zrobienia: §a✔");
    } else {
    lore.add("§fMozliwosc zrobienia: §c✖");
    }
    dbM.setLore(lore);
    db.setItemMeta(dbM);

    return db;
    }
    }