Solved Lore and enchant in config help please

Discussion in 'Spigot Plugin Development' started by DevPazzo, Feb 14, 2020 at 5:04 PM.

  1. Hi, I wanted to know how you can put it from the config, to learn more about the object and enchant with some examples written step by step thanks and very important I am Italian so I understand English very little for this I would prefer the example.
     
    #1 DevPazzo, Feb 14, 2020 at 5:04 PM
    Last edited: Feb 14, 2020 at 8:03 PM
  2. For future people looking it a way to do this is to save the actual ItemStack and see the config layout
    Code (Text):
    ItemStack dsword = new ItemStack(Material....)
    ItemMeta...
    enchant...
    lore...

    getConfig().set("Item"+dsword);
    As the set method accepts an object rather than a set variable
     
  3. I know, but how can I make them configurable in config? I had tried this but it doesn't work

    ArrayList<String> lore = new ArrayList<String>(); // makes the lore
    lore.add(plugin.getConfig().getStringList("lore)); /*adds whatevers in the config to the lore*/
     
  4. If ur asking how can you get it back im pretty sure u can get the object(item itself) and cast it to ItemStack
    ex: ItemStack itemfromconfig = (ItemStack) getConfig().get("Item")( or something like that i forgot how the return object method was named)

    You can change it directly through config,save then simply use it or make some in game commands to change each aspect and stuff..(up to you)
     
  5. Also dont think lore.add accepts string list as base argument a more likely to work code would be something like List<String> lore = plugin.getConfig().getStringList("lore");

    As the getStringList(as its named) return a object of type List
     
    • Friendly Friendly x 1
  6. so http://prntscr.com/r2i658 not work pls help me man
    this is error in console http://prntscr.com/r2i7h6
     
  7. Is the config layed out right? Seems its unable to get the "lore" line properly

    try this as well

    Code (Text):
    meta.setLore(Main.getInstance().getConfig().getStringList("lore"));
     
  8. Also im surprised some of these tricks wouldv done the work,are you sure the way ur getting the main instance is working?