Solved Remove a line from a string list

Discussion in 'Plugin Development' started by viper_monster, Aug 29, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    viper_monster

    Hey there. I need some help, how would I remove a line from this list:
    [​IMG]
    I have tried with:
    Code:java
    1. cfg.getHomesConfig().set("home." + p.getName() + "." + args[0], null);

    and
    Code:java
    1. cfg.getHomesConfig().getStringList("home." + p.getName()).remove(args[0]);

    But nothing worked :/
    Could somebody please help meh? :3 Thanks!
     
  2. Offline

    lazertester

    Get the string list, remove the element, then set the path in the config to your modified string list.
     
  3. Offline

    viper_monster

    I have tried this, but it doesnt work :/
    Code:java
    1. List<String> homes = cfg.getHomesConfig().getStringList("home." + p.getName());
    2. if (!homes.contains(args[0])) {
    3. homes.remove(args[0]);
    4. cfg.getHomesConfig().set("home." + p.getName(), homes);
    5. }
     
  4. Offline

    CeramicTitan

    Why do you have the not operator, in the if statement. Remove the '!'
     
    spoljo666 likes this.
  5. Offline

    viper_monster

Thread Status:
Not open for further replies.

Share This Page