#Config yml file not showing properly
1 messages · Page 1 of 1 (latest)
I would put a proper name and description to the thread
Config yml file not showing properly
isnt that the output you expect?
yes lol
but on the config.yml file
it doesn't show Admins
at all
cuz you never updated the file in the plugins folder
that file and the file in your resources folder are two separate things
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
By code is better, right?
cuz those 2 files are at 2 different places that dont reflect eachother
doesnt really matter
but the server config.yml should have Admins since it's returning it correctly, right?
since my get there is returning something from the server's config.yml
oh didnt even see that, did you add defaults or smth?
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;
}
so you have those 3 lines now?
copydefaults is indeed just doing smth when you set a default, config.getX() will then return the default if there wasnt any value
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
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
so the embedded one I can just ignore?
ig
so what explains Admin not showing at config.yml?
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
default is the config.yml in the jar, right?
yes
with copyDefaults(true) I make both the same thing then?
you do that in your code
its code from one of my plugins