I can't make a config.yml without it being reset

Discussion in 'Plugin Development' started by evantheis, Jul 1, 2013.

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

    evantheis

    I made a config.yml for my test plugin. But, it won't stay what I edit to it. Why would it do this?
    Code:
    Shout: 'This is the default for /shout. Change this in the plugin.yml.'
    MyIP: 'The IP youre running on is. [IP].'
    Code:java
    1. if (cmd.getName().equalsIgnoreCase("Shout")) {
    2. String msg = getConfig().getString("Shout");
    3. Bukkit.getServer().broadcastMessage(msg);
    4. return true;
    5. }
    6. if (cmd.getName().equalsIgnoreCase("IP")) {
    7. String IP = getConfig().getString("MyIP");
    8. sender.sendMessage(IP);
     
  2. Offline

    XKnucklesX

    On the onDisable method do saveConfig() I think. You could also do it anywhere after activity with the Config.
     
  3. Offline

    ddeckys

    No....
    You could do:
    saveConfig();
    or
    MyDefaultConfigObject.save(pathasstringorfile);
     
  4. Offline

    XKnucklesX

    That's what I meant the full stop was a mistake and the end part forgot. I guess you could do the save thing anywhere but also do it at the end
     
  5. Offline

    evantheis


    I do have that my onDisable()
    Code:java
    1. public void onDisable() {
    2. getLogger().info(ChatColor.RED + "Aww why would you do that!");
    3. getConfig();
    4. saveConfig();



    Shouldn't that work? Or should it be just the saveConfig() ?
     
  6. Offline

    ddeckys

    I hope you're not mixing up plugin.yml and config.yml
    Make sure you register your commands in your plugin.yml
     
Thread Status:
Not open for further replies.

Share This Page