How To Make A Config

Discussion in 'Plugin Development' started by mathiasrocker, Oct 7, 2012.

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

    mathiasrocker

    Help me how i make a config!
    I Will Like the Solver.;)
     
  2. Offline

    Tirelessly

    So you want us to write it for you..
     
  3. Offline

    mathiasrocker

    Well the plugin i will make will be big so this is a part of it

    But i will get how i save datas into a thing without config.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  4. Offline

    Tirelessly

    You need to save it to a file somewhere. No other way, aside from a database which you probably can't do.
     
  5. Offline

    mathiasrocker

    :( That's was bad.

    -------------------From here we talk about how do i make a config file best way------------------------------------------

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  6. Offline

    gomeow

  7. Offline

    ZeusAllMighty11 Retired Staff

    Start by learning about file types, and read up on the config api linked above.

    HUGE hint:
    - You can't be successful all the time unless you take the time to learn.
     
  8. Offline

    IcyRelic

    Here is how i do it

    add a file in the src folder NOT in your package
    call it config.yml and make your config there

    then in your main class create this method

    Code:
        public void loadConfiguration(){
            getConfig().options().copyDefaults(true);
            saveConfig();
       
        }
    then in your onEnable() add this line as one of the first lines of code in the onEnable()

    Code:
    loadConfiguration()
     
  9. Offline

    hawkfalcon

    I have a tut for this in the resources section.
     
Thread Status:
Not open for further replies.

Share This Page