Solved Odd values being saved to Config

Discussion in 'Plugin Development' started by acer5999, Nov 2, 2014.

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

    acer5999

    In my plugin I have a config with a few lists. But the values that are being saved aren't lists.
    Snippet of config:
    Code:
    colors:
      red:
        title: '&c&lRed'
        lore: &id001
        - '&aThis is a colour'
        - '&3But Not Just any colour.'
        - '&bThis is a &f&lChat Color.'
      aqua:
        title: '&b&lAqua'
        lore: *id001
      gray:
        title: '&7&lGray'
        lore: *id001
      blue:
        title: '&9&lBlue'
        lore: *id001
      bold:
        title: '&lBold'
        lore: *id001
      cyan:
        title: '&3&lCyan'
        lore: *id001
      green:
        title: '&2&lGreen'
        lore: *id001
      purple:
        title: '&5&lPurple'
        lore: *id001
      gold:
        title: '&6&lGold'
        lore: *id001
      lime:
        title: '&a&lLime'
        lore: *id001
      pink:
        title: '&d&lPink'
        lore: *id001
      yellow:
        title: '&e&lYellow'
        lore: *id001
      rainbow:
        title: '&o&lRainbow'
        lore: *id001
    
    Part that makes that happen:
    Code:java
    1.  
    2. List<String> lore = new ArrayList<String>();
    3. lore.add("&aThis is a colour");
    4. lore.add("&3But Not Just any colour.");
    5. lore.add("&bThis is a &f&lChat Color.");
    6. getConfig().addDefault("colors.red.title", "&c&lRed");
    7. getConfig().addDefault("colors.red.lore", lore);
    8.  
    9. getConfig().addDefault("colors.aqua.title", "&b&lAqua");
    10. getConfig().addDefault("colors.aqua.lore", lore);
    11.  
    12. getConfig().addDefault("colors.gray.title", "&7&lGray");
    13. getConfig().addDefault("colors.gray.lore", lore);
    14.  
    15. getConfig().addDefault("colors.blue.title", "&9&lBlue");
    16. getConfig().addDefault("colors.blue.lore", lore);
    17.  
    18. getConfig().addDefault("colors.bold.title", "&lBold");
    19. getConfig().addDefault("colors.bold.lore", lore);
    20.  
    21. getConfig().addDefault("colors.cyan.title", "&3&lCyan");
    22. getConfig().addDefault("colors.cyan.lore", lore);
    23.  
    24. getConfig().addDefault("colors.green.title", "&2&lGreen");
    25. getConfig().addDefault("colors.green.lore", lore);
    26.  
    27. getConfig().addDefault("colors.purple.title", "&5&lPurple");
    28. getConfig().addDefault("colors.purple.lore", lore);
    29.  
    30. getConfig().addDefault("colors.gold.title", "&6&lGold");
    31. getConfig().addDefault("colors.gold.lore", lore);
    32.  
    33. getConfig().addDefault("colors.lime.title", "&a&lLime");
    34. getConfig().addDefault("colors.lime.lore", lore);
    35.  
    36. getConfig().addDefault("colors.pink.title", "&d&lPink");
    37. getConfig().addDefault("colors.pink.lore", lore);
    38.  
    39. getConfig().addDefault("colors.yellow.title", "&e&lYellow");
    40. getConfig().addDefault("colors.yellow.lore", lore);
    41.  
    42. getConfig().addDefault("colors.rainbow.title", "&o&lRainbow");
    43. getConfig().addDefault("colors.rainbow.lore", lore);


    So far, red is the only value that is kind of there and I'm pretty sure it's because I manually edited it.
    the *id001 shouldn't be there, there should be a list there instead.
    I saw an old thread that had this problem. The solution they came up with didn't seem to work for me though.
     
  2. Offline

    Tecno_Wizard

    acer5999 , The first thing I notice is that the first lore value has this string: &id001
    All of the others have this string: *id001
    Is the class that you are writing this in static?
     
  3. Offline

    acer5999

    Nothing is in static in this class, that config setting is in my onEnable

    Solved - Decided to not save values via config and hand write them. Works now.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
Thread Status:
Not open for further replies.

Share This Page