Auto Config Shrinking

Discussion in 'Plugin Development' started by ZeusReksYou_, May 9, 2016.

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

    ZeusReksYou_

    Hello Guys,

    I am having a general problem with my config.yml. It doesn't matter for which plugin, but always my commentary gets removed if I check it in my testserver.

    For example:

    If this is what I made:

    Code:
    # Here you can fill in some names
    #
    Name 1: John
    Name 2: Tom
    
    This is what I see in the files in my testserver

    Code:
    Name 1: John
    Name 2: Tom
    
    I got a second problem. What to type in my main class, if I want to be able to add & color codes in a config.yml ? I saw a lot of threads but still don't know it :(

    What to do to prevend this?

    Sincerely,

    ZeusReksYou_
     
  2. Offline

    Zombie_Striker

    @ZeusReksYou_
    1. Comments are automatically removed every time you save the config using saveConfig(). This has been a well documented issue here. Ill look back at some of the older posts to see if anyone found a way to fix this.
    2. You can use the ChatColor.stripColorCodes(message) to add the string to the config and ChatColor.addAlternateColorCode(char-to-replace, message) to re-add the chatcolors.
     
  3. Offline

    ZeusReksYou_

    @Zombie_Striker Okay thanks, only I do not understand the ChatColor.addAlternateColorCode part.
    It seems to be the same setup like ChatColor.translateAlternateColors which i also don't understand. Could you give an example?
     
  4. Offline

    Zombie_Striker

    @ZeusReksYou_
    My mistake, I meant "ChatColor.translateAlternateColors". Here is an example on how you would use it
    Code:
    ChatColor.translateAlternateColors('&',"&4 Hello &a World")
     
  5. Offline

    ZeusReksYou_

    How would I make sure, this config translates all alternate Colors so not only Hello World? Is there any way with a for loop like:

    Code:
    String txt = "";
    (i<1; 1<args.lenght; i++)
    Or is there any way to make sure it translates all & codes in the config.yml to their correct colors?
     
Thread Status:
Not open for further replies.

Share This Page