Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The method for saving the config is not working. #73

Closed
thelipe7 opened this issue Mar 30, 2023 · 2 comments
Closed

The method for saving the config is not working. #73

thelipe7 opened this issue Mar 30, 2023 · 2 comments

Comments

@thelipe7
Copy link

Hello, I am trying to set values after loading a config but the new values are not being set, my code:
image
image
No exception is thrown, the file seems to be modified as the date changes, but the configuration values do not.

@Carleslc
Copy link
Owner

How do you load/create your config file?
And what getConfig() returns? An instance of YamlFile?
Also you do not need to load the file again after saving.
Use get("parkour.start-location") to see if the value has changed after set (or getString if location is a string).
Loading values are only needed the first time, when the plugin starts, and optionally on plugin reload.

@Carleslc
Copy link
Owner

Carleslc commented Jun 5, 2023

I'm closing this issue since there are no further details to help you and I think is not an issue with this library.

I'm guessing you have two different configuration instances and you are confused setting values on one and saving another configuration without those values set. Ensure getConfig() returns the same yamlFile instance as in your save / reload methods, and that those methods are actually executed, and getConfiguration() does not return another different configuration instance instead.

LobbyPlugin.getInstance().getConfig() == LobbyPlugin.getInstance().getConfiguration().yamlFile should return true (same instance).

Otherwise, maybe you are confusing the Bukkit's plugin configuration with the configuration instance of this library (YamlFile)? Please don't mix them, use one or another. This library is independent of Bukkit / Spigot / Velocity and can also be used in any Java program.

You can comment if you need more help.

@Carleslc Carleslc closed this as completed Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants