.getConfigurationSection(path).getKeys(false) Returning wrong data

Discussion in 'Spigot Plugin Help' started by MrAxeTv, Sep 16, 2019.

  1. hello there I am having problems with getKeys(false) method
    it is returning wrong key I mean not wrong but from wrong place instead of garbing it from config file which is created in plugin folder it is getting it from jar file
    so example I have removed some default keys which are coming with default config
    be they are still showing up when I use getKeys method why is that so
    look like getkeys is getting them from jar config file because those values don't exist in plugin folder config file
    I hope some body will understand me
    Here is example
    if I remove cow from config file reload plugin restart server of course
    still after there is no more cow in config.yml
    but getkeys will still get that cow from config file in jar file from some reason

    this is line of code which I am using pl.getConfig().getConfigurationSection("MobLevel").getKeys(false)
  2. Hello,

    Do you correctly use #saveConfig() after removing your keys?
    If so, then I think you'll have to manually load your config.yml into a new YamlConfiguration, because the JavaPlugin#getConfig() also loads the config.yml from the jar (and add the values as defaults)
  3. I have tried to create new object this is my class https://pastebin.com/XEyEBg6f
    made new method getConfig and again the same xd
  4. How do you remove a key from the config, and how do you save it now? Can you show us some code please.
  5. by stoping server removing it and starting server
  6. This should work.
    Make sure that you load, get & save the config from your YmlCreator class, and not from the JavaPlugin class.
  7. I did that but still