config.yml syntax

Discussion in 'Plugin Development' started by crazicrafter1, Jan 28, 2016.

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

    crazicrafter1

    I've been recently learning java, and am wondering if theres a way in eclipse to create a system to create custom syntax, like players being able to customly create kits in essentials, or those plugins where you can edit the config.yml alot. Is there a way?
    ex:

    kits:
    member:
    delay: 60
    items:
    - 298 1 protection:2 name:&7Member_Helmet
    - 272 1 sharpness:1 name:&7Member_Sword
    trainee:
    delay: 4050
    items:
    - 298 1 protection:3 name:&6Trainee_Helmet

    not to have code above exactly like that, but the idea to create ti customly is what im trying to find.
     
  2. Offline

    wesley27

    @crazicrafter1 Forgive me if I misunderstand what you're asking, but I believe you're asking if you can make your own syntax in the config.yml file?

    If this is what you're asking, than the answer is absolutely!

    The config.yml has no real "defined" or "necessary" syntax, other than the necessary means of reading and writing a YML file. If you create a plugin, you can make the config.yml look and be used however you like, in nearly any format as long as it follows proper YML format(no tabs) and is readable by the Bukkit API.

    So Yes, you could make a config.yml look like your example.
     
  3. Offline

    crazicrafter1

    Is there a way to do it?
     
  4. Offline

    teej107

    yes
     
  5. Offline

    crazicrafter1

    Then how? That's what I'm trying to find out :p
     
  6. Offline

    mythbusterma

  7. Offline

    crazicrafter1

    How can I parse it?
     
  8. Split the string to spaces " "
    The Material must be the first String, you should check if String contains ':' and if it contains it split int and get the dataValue.
    Check if there's a second String and that should be the amount, you can also put the amount on the first String like this "material:datavalue,amount" just an example.

    From here you will have to split the rest of values, checking if is an enchantment, etc...
     
Thread Status:
Not open for further replies.

Share This Page