Color Codes not stretching over lines

Discussion in 'BungeeCord Plugin Development' started by AgentLV, Jun 14, 2015.

  1. Hello together,
    I am having problems sending player messages through Bungeecord, the color codes only work until the end of the line.
    Code (Text):
    String notOnTownyServer = ChatColor.translateAlternateColorCodes('&', cfg.getString("notOnTownyServer"));

    p.sendMessage(new ComponentBuilder(TownyPipeBungee.notOnTownyServer).create());
  2. I know, but the problem is, the string can be changed in the config and I don't know which color codes are used and which not.
  3. Found a fix myself
    Code (Java):
    public static BaseComponent[] couldNotConnect;
    Configuration cfg = null;
            try {
                cfg = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(getDataFolder(), "config.yml"));
            } catch (IOException e) {
    couldNotConnect = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', cfg.getString("couldNotConnect")));
    #4 AgentLV, Jun 14, 2015
    Last edited: Jun 26, 2015