Config file commentare

Discussion in 'Plugin Development' started by bremdecoolste, Sep 17, 2013.

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

    bremdecoolste

    public void loadConfig() {
    getConfig().addDefault("#How long do players have to wait before they can send a new request?");
    getConfig().addDefault("Tpa-cooldown", 5);
    getConfig().addDefault("Timeout", 60);
    getConfig().options().copyDefaults(true);
    saveConfig();

    Won't work, as it all the time wants to correct addDefault... What do I have to type instead?
     
  2. Offline

    1Rogue

    Code:java
    1. File file = new File(plugin.getDataFolder() + File.separator + "config.yml");
    2. if (!file.exists()) {
    3. loadConfig();
    4. }
     
  3. Offline

    bremdecoolste

    Where do I put my text like "Timeout" etc?

    Sorry, im really new-bish when talking about permissions and hasmaps and stuff

    1Rogue
     
  4. Offline

    Retherz_

    public void onEnable() {
    this.getServer().getPluginManager().registerEvents(this, this);
    getConfig().options().copyDefaults(true);
    saveDefaultConfig();
     
  5. Offline

    1Rogue



    "timeout"?

    What are you talking about when you mean a timeout, a config value?
     
  6. Offline

    bremdecoolste

    Yes.

    so how would it look like? (send me the code including the text I had please)
    1Rogue
     
  7. Offline

    1Rogue


    plugin.getConfig().getInt("timeout");

    Depending on where it is in your config, it may be a different string for getInt. Also plugin would be your plugin's main class that extends JavaPlugin.
     
Thread Status:
Not open for further replies.

Share This Page