Solved Reloading Config

Discussion in 'Plugin Development' started by user_90599104, Sep 28, 2012.

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

    user_90599104

    Hello!
    I am making a plugin and I have to reload the config.yml with a command.
    The command is in a separate class: Commandreload and it gives me a error with reloadConfig();
    Can you give me a example to help me?
    I am fairly new to the bukkit API.
    Thank you
    Odie680
     
  2. Offline

    Sagacious_Zed Bukkit Docs

    What is the error?
     
  3. Offline

    andf54

    Why you have [help] in your title? Its plugin development, so its kind of obvious you ask for help.
     
  4. Use this
    Code:
     
    public class classname {
     
     
        public classname(mainclass instance) {
            plugin = instance;
         
         
        }
     
     
     
    //Then for onCommand do
    plugin.reloadConfig();
        
     
  5. Offline

    user_90599104

    How about if you have a config file called BlahBlah.yml How do you reload config.yml AND BlahBlah.yml
     
  6. Your saying you have mutliple files that generate Or are you just talking hypathetically ?
     
  7. Offline

    user_90599104

    I have multiple files and I want it when I do /reloadconfig it reloads ALL of them. Like I have config.yml and rules.yml
     
  8. Let me do some research and get back to you

    Code:
    public void reloadCustomConfig() {
        if (customConfigFile == null) {
        customConfigFile = new File(getDataFolder(), "customConfig.yml");
        }
        customConfig = YamlConfiguration.loadConfiguration(customConfigFile);
     
        // Look for defaults in the jar
        InputStream defConfigStream = this.getResource("customConfig.yml");
        if (defConfigStream != null) {
            YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
            customConfig.setDefaults(defConfig);
        }
    }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  9. Offline

    user_90599104

    Sorry for being nooby but in which class does it go in. Thanks a lot for your time =D
     
  10. Offline

    calebbfmv

    Any class really. But if you need it on command, and you have all your commands in one class put it in there
     
  11. You could put the method(Which is what that is) inside anyclass... Than in the onCommand call the method
     
  12. Offline

    calebbfmv

    Same thing
     
  13. Offline

    user_90599104

    Thanks a lot! This is solved
     
  14. lol yeah I kinda just wanted to say something :D

    Maybe I can have a like for helping you ... (TROLLFACE) ?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
    D0tJar and JoloCodeBrahs like this.
Thread Status:
Not open for further replies.

Share This Page