#Config yml file not showing properly

1 messages · Page 1 of 1 (latest)

north cloak
#

@loud lance

#

on intellij:
config.yml:

Admins: ['Player']
FlyAccess: ['MyNick']```
daring wren
#

I would put a proper name and description to the thread

north cloak
#

Config yml file not showing properly

loud lance
#

isnt that the output you expect?

north cloak
#

but on the config.yml file

#

it doesn't show Admins

#

at all

loud lance
#

cuz you never updated the file in the plugins folder

#

that file and the file in your resources folder are two separate things

north cloak
#

I know, but I compiled Intellij's config.yml file with Admins in it

#

and it is in it on the compiled form (on the server)

#

but it just doesn't show

#

so if I want to change Admins i cant

loud lance
#

youll have to manually add it

#

either by code or by hand

north cloak
#

By code is better, right?

loud lance
#

cuz those 2 files are at 2 different places that dont reflect eachother

#

doesnt really matter

north cloak
#

since my get there is returning something from the server's config.yml

loud lance
#

oh didnt even see that, did you add defaults or smth?

north cloak
#

used to have a saveDefaultConfig() or smth under the copydefaults one, but someone told me that this didn't do nothing

onEnable(){
  getConfig().options().copyDefaults();
}

after changing smth on the config.yml:

plugin.getConfig().set("FlyAccess",nickList);
plugin.saveConfig();
@Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
        if(command.getName().equalsIgnoreCase("get"))
        if(sender instanceof Player p){
            p.sendMessage(getConfig().getStringList("Admins").get(0));
        }
        return false;
    }
loud lance
#

so you have those 3 lines now?

north cloak
#

on total, no

#

oh, wait a minute, i forgot the Admin part

loud lance
#

copydefaults is indeed just doing smth when you set a default, config.getX() will then return the default if there wasnt any value

north cloak
#

So there's 2 config.yml files on my server folder: the default and the current one, right?

#

once i save the current it becomes default

loud lance
#

there is a config file in your server folder/plugins/your plugin/config.yml and the other one is an embedded resource present in the jar file of your plugin, where you cant interact with unless you move it to the plugins folder

#

its just a binary stream

north cloak
#

so the embedded one I can just ignore?

loud lance
#

ig

north cloak
#

so what explains Admin not showing at config.yml?

loud lance
#

cuz its in the config file in your jar file but not in the server

#

this is how you get the file that you were editing in intellij

#

where core is your plugins instance

#

saveResource moves a embedded file from the jar to the plugins folder on the server

north cloak
#

default is the config.yml in the jar, right?

loud lance
#

yes

north cloak
#

with copyDefaults(true) I make both the same thing then?

loud lance
#

you dont need that

#

its just my code

north cloak
#

you do that in your code

loud lance
#

its code from one of my plugins

north cloak
#

but you do configuration.options().copyDefaults(true)

#

so i think that's why it works ig

north cloak
#

at the end it does work with true on copyDefaults

#

only that

#

i kinda get why

#

but i'm the type of person that likes to know everything to it's core

#

so i'm not satisfied

#

but thank you very much for your efforts