How to save an itemstack to a config?

Discussion in 'Spigot Plugin Development' started by kinukin, Jun 7, 2017.

  1. Code (Text):
            ItemStack test= new ItemStack(Material.WOOD_SWORD);
            ItemMeta testMeta= test.getItemMeta();
            testMeta.setDisplayName(name1);
            test.setItemMeta(testMeta);
    How would I put this ItemStack directly into a config, without an inventory?

    Thanks
     
  2. Same as saving anything else in YAML..

    set("path", itemStack);

    To get it just use

    ItemStack itemStack = getItemStack("path");
     
    • Agree Agree x 1
  3. Yepp, the YamlConfiguration has ItemStack type, it is very useful and comfy. :)