Solved Quoting string in yaml config "\\"

Discussion in 'Plugin Development' started by BurnyDaKath, May 5, 2015.

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

    BurnyDaKath

    I have in event onPlayerJoin this code:
    Code:
    this.plugin.config.set("Players." + player.getName() + ".prefix", "\\xa7e[PLAYER]\\xa7r" );
    I want to quote \xa7e[PLAYER]\xa7r, because after event it appears in config unquoted. I tried "\"\\xa7e[PLAYER]\\xa7r\"" and "\"" + "\\xa7e[PLAYER]\\xa7r" + "\"", but in YAML config it appears unquoted. Is there any way to quote this so code works properly?

    Sorry for inconvenience, i solved that and, if you want to see how i done it, here it is:
    I wanted \xa7r to be &r as my code translates it into YAML config.
    So what i've done is change code to:
    Code:
        String texty = "&e[PLAYER]&r";
                String prefixResult1 = ChatColor.translateAlternateColorCodes('&', texty);
                this.plugin.config.set("Players." + player.getName() + ".prefix", prefixResult1);
    Easy, isn't it? :D

    EDIT by Timtower: merged posts
     
    Last edited: May 7, 2015
Thread Status:
Not open for further replies.

Share This Page