Dealing with Config Files! (YAML)

< . . . Dealing with Config FIles! (YAML) . . . >


Well i decided to make this small tutorial to help people without any experience to use any configuration file for plugins, so here we go.

  • DON'T DO THAT IN A CONFIG FILE:
    • DON'T USE TABS, TABS WILL BREAK YOUR FILE, USE ONLY SPACES!!!
    • Respects the Spacing:
      • Coders don't add 200 spaces for fun, that means the configuration senction involved belongs to another (it's part to another) because is inside it's path, so in this example, you can change the value of colors, but DON'T TOCH THE SPACES.
        • Colors:
          • Red: 1
          • Blue: 2
          • Green: 3



  • Configuration Sections:
    • Booleans: that kind of conf sections has only 2 possible options, "true" or "false", basically used to enable/disable an option.

    • Integer/Double/Long...: they're numeric conf sections, depending on the "type" the format will vary, for example an integer will NEVER have decimals, for that, coders use double format. Besides we have the long format, that usually stores dates.
      • Integer: 27
      • Double: 12.50
      • Long: 984294298492489

    • Strings: a string is just a sentence, which NEEDS to start and finish with the ' simbol if has special characters as " & " or " $ ".
      • String: hi there
      • String: '&aHow is going?' (note the ' to start and finish due to the added simbol to use bukkit color/format codes)

    • Lists: this is probably the most difficulty conf section to understand for non-experienced people, lists are LISTS of values (any kind, integers, strings...), lists are not that hard, you can just remove all entries, modify, or add the ones you need, for example, a list of worlds to process:
      • List:
      • - world
      • - world_nether
      • - world_the_end