Config HELP!

Discussion in 'Plugin Development' started by Divinity Realms, Feb 5, 2015.

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

    Divinity Realms

    Is there any really good tutorials that explain well how to store information and retreieve/edit information in a config file. The ones ive found dont do the trick. Please help!
     
  2. Offline

    _Cookie_

    Divinity Realms likes this.
  3. Offline

    Divinity Realms

    Thanks dude!

    @_Cookie_ Not custom config just normal :/ I also want to find out how to add a player and a cooldown to a player. Im strugling with it a lot

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

    mythbusterma

  5. Offline

    Darkpicasa

    Basic things you might need for config:

    getConfig().options.copyDefaults(true);
    saveConfig();

    You should call that in your onEnable somewhere.

    getConfig().set(String path, Object value) - sets a path to be a certain object.

    getConfig().createSection(path) - creates a configuration section at that specific path

    getConfig().getConfigurationSection(path) - gets a configuration section create

    getConfig().get String/Integer/Double/StringList/etc (path) - gets the object at a specific path

    getConfig().contains(path) - Returns true if the path exists in the config

    That should be a good introduction to configs, I hope :/
     
    Divinity Realms likes this.
  6. Offline

    Divinity Realms

    the options. is undefined...
     
  7. @Divinity Realms The line getConfig().options.copyDefaults(boolean) should be in the class that extends JavaPlugin. AKA, your main class.
     
Thread Status:
Not open for further replies.

Share This Page