Problem with item meta

Discussion in 'Plugin Development' started by Pixyde, Aug 25, 2021.

  1. Offline

    Pixyde

    Hi, I have been programming a plugin for a few days and I encountered a problem with item meta doing weird things.
    Code:
       ItemStack chainpants = new ItemStack(Material.CHAINMAIL_LEGGINGS);{
            ItemMeta chainpantsM = chainpants.getItemMeta();
                chainpantsM.setDisplayName("Pantalon suivant");
                chainpantsM.setLore(Arrays.asList("Prix : 20 diamants", "Cliquer pour acheter"));
                chainpants.setItemMeta(chainpantsM);
            } 
        ItemStack chainboots = new ItemStack(Material.CHAINMAIL_BOOTS);{
            ItemMeta chainbootsM = chainboots.getItemMeta();
                chainbootsM.setDisplayName("Bottes suivante");
                chainbootsM.setLore(Arrays.asList("Prix : 20 diamants", "Cliquer pour acheter"));
                chainboots.setItemMeta(chainbootsM);
            }
    i have these two item, and it seems like the pants is sharing is itemmeta withe the boots.
    The pants look normal :
    Screenshot_15.png
    but the boots get the meta of the pants :
    Screenshot_16.png

    I have no idea why it do this because I have 20 other items that I coded the same way and they all work.
    If you have any idea of what I did wrong please share it with me.
     
  2. Offline

    xpaintall

    Can you share more code please? This isn't enough to figure out what' s the problem. Also, why did you put brackets when it's not a statement?
     

Share This Page