config List, Colors

Discussion in 'Plugin Development' started by stamline, Sep 20, 2015.

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

    stamline

    Hi, i want to make so the StringList will be color supported. My code is half working. Everything is fine if i dont use the '&' as the first letter/symbol.

    So this is not working "&5Hello"
    but this is working "H&5ello"

    Do you guys have any ideas to make this work?
    Here is my code
    Code:
    if(args.length == 0){
                List<String> Message = Main.plugin.getConfig().getStringList("HelpMessages");
                for(String mess : Message){
                    mess = ChatColor.translateAlternateColorCodes('&', mess);
                    sender.sendMessage(mess);
                }
            }
     
  2. Offline

    Zombie_Striker

    @stamline
    Try adding something at the beginning of the message(you could even add Chatcolor.WHITE, that way nothing is changed and no extra text is added.).
     
  3. Offline

    pedrinholuizf

    If you dont care about people using & on the messages, you could simply do .replace("&", "ยง")
     
  4. Offline

    mythbusterma

    @Zombie_Striker

    Nope.

    @pedrinholuizf

    Even less correct.

    @stamline

    Make sure in the config file that you're escaping the string properly, an attribute that begins with "&" has a different meaning in YAML.
     
Thread Status:
Not open for further replies.

Share This Page