Method add(capture#1-of ?)

Discussion in 'Plugin Development' started by Calamandrey, Jun 14, 2020.

Thread Status:
Not open for further replies.
  1. I'm coding a plugin and I have to make it create a list in a config.yml file. So i use the method:
    conf.getList(directory of list).add(object)
    So this is an example of my class:
    conf.getList(directory).add("alberto")
    but it retuns me this error:
    "The method add(capture#1-of ?) in the type List<capture#1-of ?> is not applicable for the arguments (String)"
    How can i solve it?
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Calamandrey Get the list into a variable.
    Add the value.
    Set the list.
     
  3. So like: "list<String> alberto;
    alberto.add("alberto");
    conf.getList(directory).add(alberto);"?
     
  4. Offline

    timtower Administrator Administrator Moderator

    @Calamandrey. First line should get the current list first.
    Third line should be a set
     
Thread Status:
Not open for further replies.

Share This Page