Setting lore color in config?

Discussion in 'Plugin Development' started by EgyptianKing, Aug 9, 2014.

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

    EgyptianKing

    So here's my code:

    Code:java
    1. List<String> lore = (List<String>) getConfig().getList("rewards.item_lore");
    2.  
    3. for(String s : lore)
    4. {
    5. s = ChatColor.translateAlternateColorCodes('&', s);
    6. }


    I'm trying to get it so that color would work in the lore. But this isn't working, any ideas?
     
  2. Offline

    JustinsCool15

  3. Offline

    SGrayMe

  4. Offline

    _LB

    Your for loop doesn't change any strings, it only assigns to the temporary string references you get from iteration. In other words, Java isn't as cool as C++.
     
  5. Offline

    EgyptianKing

    _LB
    Do you know how I can make it assign to each element in the lore?
     
  6. Offline

    chaseoes

    Like this?
    Code:java
    1. List<String> lore = getConfig().getStringList("rewards.item_lore");
    2. List<String> coloredLore = new ArrayList<String>();
    3.  
    4. for (String s : lore) {
    5. coloredLore.add(ChatColor.translateAlternateColorCodes('&', s));
    6. }
     
    _LB and EgyptianKing like this.
Thread Status:
Not open for further replies.

Share This Page