Solved Multiple configs problem

Discussion in 'Spigot Plugin Development' started by NickDEV, May 14, 2016.

  1. Hello! This is my first time using multiple configs and I already got a problem. I created the SettingsManager class: and everything works fine as long I'm using the SettingsManager's methods in the SettingsManger class, but if I try to use them in other class for example Messages class: it throws an error:

    The configs get generated normally and I also tried to write something in them. (worked fine as long as I'm in the SettingsManager class)

    Thanks for help!
  2. Try to add this
    Code (Text):

        static SettingsManager instance = new SettingsManager();
        public static SettingsManager getManager(){
            return instance;
    and then to use the settings from another class do SettingsManager sm = SettingsManager.getManager();
  3. Done, error:
  4. You're not loading the messages.yml file in the setup method,
    do messages = YamlConfiguration.loadConfiguration(mfile)
  5. @Fex28 My bad forgot to do that, still the same error.
  6. ?
  7. I think sm its the proplem here, you shoule try to call the setup() method before using sendMessage()
    • Winner Winner x 1
    • Like Like x 1