MySQL Error :: Adress is invalid on local.....

Discussion in 'Spigot Plugin Development' started by StarFan33, Jul 12, 2018.

  1. Have you seen if the phpadmin (if you use it) is on? Or you simply are not taking the values from Config as i see.
     
  2. Njada. Zero. Null 0or with other words: nothing got created. and i will need to get them from config.
     
  3. I dont know how (is this kotlin) works, but i think you need to initialize your url in your method.
    If it behaves like java, it doesn‘t know getConfig() at the time it initializes the variables.
     
  4. You can use your own File instead of using JavaPlugin's config, is an option. Just replace your values and keys here:
    Code (Java):
    try {
                File file = new File(path, "config.yml");
                if (!file.exists()) {
                    file.getParentFile().mkdirs();
                    file.createNewFile();
                }
                YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
                cfg.set(path, value);
                cfg.save(file);
            } catch (IOException e) {
                e.printStackTrace();
            }
     
  5. Allready using a config.yml
     
  6. I was meaning to say *File method*
    You would use the File and YamlConfiguration vars like general vars for all class, then use cfg.getString(path) to get the values. And one more thing the !file.exists() bracket must contains the rest of code of cfg.set(String,Object) and cfg.save(File) i forgot that. and add cfg.load(file) after that
     
  7. config.getString("test") is equals to getConfig.getString() in Java
     
  8. your own cfg not working too.
     
  9. Code (Java):

        internal var file = File("path", "config.yml")
        internal var cfg: YamlConfiguration? = null

        fun load() {
            try {
                if (!file.exists()) {
                    file.parentFile.mkdirs()
                    file.createNewFile()
                    cfg = YamlConfiguration.loadConfiguration(file)
                    cfg!!.set("path", "value")
                    cfg!!.save(file)
                }              
                cfg = YamlConfiguration.loadConfiguration(file)
                cfg!!.load(file)
            } catch (ex: IOException) {
                ex.printStackTrace()
            } catch (e1: InvalidConfigurationException) {
                e1.printStackTrace()
            }

        }
     
  10. Nice, you have found a way to crash it completly.... Congrats @DJgamer29 your config added an npe and other unpretty shit.
     
  11. Thanks @ExoBiTe for the advise / reply, I fixed it now succes
     
    • Like Like x 1