Solved How to write to the Config?

Discussion in 'Plugin Development' started by blok601, Oct 17, 2015.

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

    blok601

    How would I write to the config? So basically when I player joins, I want to add their name to the config with 5 kills.
     
  2. Offline

    mcdorli

    getConfig().set("path", object), You should check out the javadocs.
     
  3. Offline

    Badwolf330

    @blok601
    Code:
      public void onPlayerJoin(PlayerJoinEvent event){
        getConfig().set(path, object);
    }
     
    blok601 likes this.
  4. Offline

    mcdorli

    Don't spoonfeed him.
     
  5. Offline

    SuperSniper

  6. Offline

    Badwolf330

  7. Offline

    blok601

    I meant like the player isn't in the config, and then when they join the get added. Of course if its their first time joining and all.
     
  8. Offline

    mcdorli

  9. Offline

    blok601

    I know that.

    I basically want an empty config lets say.

    Then when the player joins, and I confirm they have never played before, I want to create a path in the Config.
     
  10. Offline

    567legodude

    @blok601 To check if they have never played (first time joining) use the method
    Then to set a value to the config use
    And finally call saveConfig() to make sure it's saved.
     
  11. Offline

    mcdorli

    And? If the path doesnt exists, then the getConfig().set(String path, object) creates it. Then you need to save the config using the getConfig().save() method.
     
  12. Offline

    blok601

    Sorry. I was impatient. Sorry if I annoyed you :/. Thank you @mcdorli
     
  13. Offline

    mcdorli

    No problem, I never get really annoyed.
     
Thread Status:
Not open for further replies.

Share This Page